RESOLVED WORKSFORME 149175
JS Function removed after parsing
https://bugs.webkit.org/show_bug.cgi?id=149175
Summary JS Function removed after parsing
Rodney Rehm
Reported 2015-09-15 11:29:20 PDT
Steps to reproduce: Open http://rodneyrehm.de/t/css.escape (with cold cache / freshly started browser) and open DevTools and run `CSS.escape` to print the value. Expected behavior: The function's body is printed to the console Actual behavior: `undefined` is printed to the console Additional Notes: The issue cannot be reproduced reliably. Sometimes hitting Command+R will make CSS.escape actually hold the function, sometimes you need Command+Shift+R. Usually cleaning the cache and or restarting the browser before opening this page will make WebKit (or JavaScriptCore, or whatever) exhibit this behavior. Eventually CSS.escape will hold the function, but it may lose it again. It feels like some script optimization routine is (sometimes) killing the function declaration, because it is not used immediately (i.e. dead code removal), or some such. Live Testcase: http://rodneyrehm.de/t/css.escape Related issue on Github: https://github.com/mathiasbynens/CSS.escape/issues/2
Attachments
patch that has the regression test (5.10 KB, patch)
2016-05-06 11:07 PDT, Filip Pizlo
mark.lam: review+
Mathias Bynens
Comment 1 2015-09-21 01:27:32 PDT
Confirmed in r189569.
Nikita Vasilyev
Comment 2 2015-11-17 19:22:52 PST
*** This bug has been marked as a duplicate of bug 126337 ***
Mathias Bynens
Comment 3 2015-12-01 09:12:34 PST
(In reply to comment #2) > > *** This bug has been marked as a duplicate of bug 126337 *** Note that this is not really a duplicate of bug 126337. Fixing bug 126337 would work around the issue in this specific case of `CSS.escape` but the underlying JavaScriptCore bug would still be there.
Nikita Vasilyev
Comment 4 2015-12-01 20:04:47 PST
Oh, you're right. Sorry about that. It isn't about WebKit missing CSS.escape. It is about a bizarre WebKit behavior with this particular CSS.escape shim.
Derk-Jan Hartman
Comment 5 2016-02-01 12:33:15 PST
We encountered the same issue (with the same polyfill) in Wikipedia/MediaWiki. Issue was tracked: https://phabricator.wikimedia.org/T121991
Radar WebKit Bug Importer
Comment 6 2016-02-01 16:08:42 PST
Aaron Michal
Comment 7 2016-03-25 12:20:10 PDT
You can also reproduce it be delaying the lookup with a setTimeout. The code below alerts('window.CSS.escape missing in event') in Version 9.1 (10601.5.17.4) <html> <script src='css.escape.js'></script> <script type='text/javascript'> if (!window.CSS.escape) { alert('window.CSS.escape not loaded'); } console.log(!!window.CSS.escape); setTimeout(function() { console.log(!!window.CSS.escape); if (!window.CSS.escape) { alert('window.CSS.escape missing in event'); } },5000); </script> </html>
Filip Pizlo
Comment 8 2016-05-06 10:57:34 PDT
I can't get this to reproduce in WebKit trunk right anymore. Please reopen if you can get it to fail in trunk, nightly, etc.
Filip Pizlo
Comment 9 2016-05-06 11:07:58 PDT
Created attachment 278255 [details] patch that has the regression test
Mark Lam
Comment 10 2016-05-06 11:09:24 PDT
Comment on attachment 278255 [details] patch that has the regression test rs=me if it bots don't complain.
Derk-Jan Hartman
Comment 11 2016-05-06 12:25:00 PDT
Confirmed. Still broken in Safari Version 9.1 (11601.5.17.1), but works in STP Version 9.1.1 (11601.6.17, 11602.1.29).
Note You need to log in before you can comment on or make changes to this bug.