RESOLVED FIXED Bug 126522
Named object access properties should be configurable or don't exist at all
https://bugs.webkit.org/show_bug.cgi?id=126522
Summary Named object access properties should be configurable or don't exist at all
Derk-Jan Hartman
Reported 2014-01-06 06:37:13 PST
This is about the side effects of http://www.w3.org/TR/html5/browsers.html#named-access-on-the-window-object It seems the properties that this named access creates on the window object are non-configureable. This makes it 'randomly'/'DOM dependent' impossible to create properties on the window object. Apparently Safari is the only browser that has them unconfigurable and the only browser that has them defined as actually properties. There might be a good reason for this (security ?). However, it's annoying, especially for JS libraries that might be deployed. This impredictability of which properties on your window object are defined makes this a nuisance to developers and more so. I think this should be changed. I ran into this problem here: https://github.com/ajaxorg/ace/issues/1741 Additionally specific to Safari, this seems to create a problem with local declared but uninitialized variables, which might be even more problematic. This problem is detailed in the console.log example in http://dertompson.com/2013/08/07/named-access-on-the-window-object-in-safari/ This might give a scripter unintentional and obscured access to these named objects causing unpredictable results. Further background reading materials: http://tjvantoll.com/2012/07/19/dom-element-references-as-global-variables/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=11960
Attachments
Reduced testcase (458 bytes, text/html)
2016-09-14 05:05 PDT, Derk-Jan Hartman
no flags
Derk-Jan Hartman
Comment 1 2015-06-30 13:55:49 PDT
This seems to be fixed in Safari 9 Seed 1 ?
Derk-Jan Hartman
Comment 2 2016-09-12 12:42:23 PDT
Hmm, or not, it seems that this issue still exists and I just ran into it again. Had a header with id="addOnloadHook", then was trying to define a property on window with the key 'addOnloadHook'. This was impossible due to named access.
Derk-Jan Hartman
Comment 3 2016-09-14 05:05:31 PDT
Created attachment 288806 [details] Reduced testcase
Derk-Jan Hartman
Comment 4 2018-06-04 06:02:57 PDT
This problem seems resolved in at least Safari 11.1 Not sure when the fix was made.
Note You need to log in before you can comment on or make changes to this bug.