Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

defer_javascript errors in Safari 4.x and 5.0, user scripts fail #927

GoogleCodeExporter opened this issue Apr 6, 2015 · 6 comments


Copy link

What steps will reproduce the problem?
1. Make sure that defer_javascript filter is enabled.
2. Create page that loads at least one script element (doesn't matter which 
script, I'm using a popular Google-hosted library as an example), plus a second 
script element with an alert().
3. Load the page.

What is the expected output?
Script to run, alert to fire (which worked in 1.6.x)

What do you see instead?
Script runs with error "PSA Error: Exception while overriding 
document.readyState.defineProperty is not supported on DOM Objects.", alert 
never fires.

What version of the product are you using (please check X-Mod-Pagespeed

On what operating system?
Red Hat Enterprise Linux Server release 6.5 (Santiago)

Which version of Apache?

Which MPM?

URL of broken page:
With Filter:

Without Filter:


I've had end-users confirm this behavior in older Safari builds (which they 
can't upgrade from because Apple locks this on old OSes), and am able to 
recreate it in BrowserStack as well (with extensions disabled).  Safari 5.1+ 
seems to be unaffected. I've also seen someone else report this behavior on the 
ngx_pagespeed tracker (

For now, I'll need to disable the filter on the server (so I've included it in 
the links above). Please let me know if there are any other details needed.

Original issue reported on by on 9 Apr 2014 at 10:09

Copy link

Thanks for the repro.  Just to confirm, it seems to behave the same on Safari 7 
as it does on modern Chrome.

We should probably just turn off defer_javascript on old safari.

Original comment by on 9 Apr 2014 at 11:22

Copy link


Yes, I was unable to recreate the issue in Safari 5.1 or above (including 
7)--so I think those versions are ok (although I was only able to test a 
handful of builds).  It may be easier to disable it in those cases--but since 
the 1.6.x branch worked fine, maybe this is just a bug in the injected script 
to process the deferred content.

While there's plenty out there reminding people that the defer_javascript 
filter can break their self-referencing scripts and such, I don't think anyone 
would expect a loss of basic functionality. It would be nice if there was a way 
for regressions like this to get caught through an automated test suite, as I'm 
sure these aren't the only cases in older browsers--this one is just more 
impactful, since old Mac OSX versions can't upgrade to a newer Safari.

Original comment by on 10 Apr 2014 at 12:22

Copy link

[deleted comment]

Copy link

I've been able to reproduce using Safari 3.2.2. It looks like this was due to 
r3656. Still tracking down what in the change is causing the issue though.

For the record, I think that "PSA Error" message is a red herring as I see it 
printed out in safari 5.1 which does work correctly.

We do also have automated browser tests for this code, but unfortunately our 
infrastructure doesn't support any versions of safari older than 5.1 so we 
didn't catch this problem.

Original comment by on 11 Apr 2014 at 2:37

Copy link

I lied this was actually due to the changes in r3376. Fix should be forthcoming.

Original comment by on 11 Apr 2014 at 9:02

Copy link

This issue was closed by revision r3936.

Original comment by on 14 Apr 2014 at 3:08

  • Changed state: Fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

1 participant