RESOLVED WORKSFORME 123983
window.Location is undefined
https://bugs.webkit.org/show_bug.cgi?id=123983
Summary window.Location is undefined
Tom Van Goethem
Reported 2013-11-07 03:08:47 PST
The following script will throw a TypeError ('undefined' is not a valid argument for 'instanceof' (evaluating 'window.location instanceof window.Location')) because window.Location is undefined <script> if (window.location instanceof window.Location) { console.log('ok'); } </script> Other browsers I tested (Chrome 30.0/FireFox 24.0) do not have this issue.
Attachments
Mathias Bynens
Comment 1 2013-11-07 03:20:18 PST
Minimal test case: data:text/html,<script>var%20result%20=%20'FAIL';%20try%20{%20if%20(window.location%20instanceof%20window.Location)%20{%20result%20=%20'PASS';%20}%20}%20catch(e)%20{}%20document.write(result);</script> FWIW, I get PASS on WebKit nightly r158804.
Tom Van Goethem
Comment 2 2013-11-07 03:29:00 PST
> Minimal test case: > > data:text/html,<script>var%20result%20=%20'FAIL';%20try%20{%20if%20(window.location%20instanceof%20window.Location)%20{%20result%20=%20'PASS';%20}%20}%20catch(e)%20{}%20document.write(result);</script> > > FWIW, I get PASS on WebKit nightly r158804. This returns FAIL on Safari 6.0.5 (8536.30.1), Mac OS X 10.8.5 and Safari 6.0 (8536.25), iOS 6.1.3
Alexey Proskuryakov
Comment 3 2013-11-07 09:32:12 PST
window.Location has been supported for a long time. There might have been some issue with instanceof, but Safari 6.0.5 is ancient history, and so is iOS 6. This test works as expected in Safari 7.
Note You need to log in before you can comment on or make changes to this bug.