New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this Issue Apr 6, 2015 · 6 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Apr 6, 2015

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
header)?
1.7.30.4-3847

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

Which version of Apache?
2.2.15

Which MPM?
Prefork

URL of broken page:
With Filter: 
http://www.harvest.org/JustinB/pagespeed_test.html?ModPagespeedFilters=defer_jav
ascript

Without Filter: 
http://www.harvest.org/JustinB/pagespeed_test.html?ModPagespeedFilters=-defer_ja
vascript

---------

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 (https://github.com/pagespeed/ngx_pagespeed/issues/643).

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 code.google.com by Justin.M...@gmail.com on 9 Apr 2014 at 10:09

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

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 jmara...@google.com on 9 Apr 2014 at 11:22

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Jmara,

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 Justin.M...@gmail.com on 10 Apr 2014 at 12:22

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

[deleted comment]
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

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 j...@google.com on 11 Apr 2014 at 2:37

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

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

Original comment by j...@google.com on 11 Apr 2014 at 9:02

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

This issue was closed by revision r3936.

Original comment by j...@google.com on 14 Apr 2014 at 3:08

  • Changed state: Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment