Bug 123983 - window.Location is undefined
Summary: window.Location is undefined
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.8
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-07 03:08 PST by Tom Van Goethem
Modified: 2013-11-07 09:32 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Van Goethem 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.
Comment 1 Mathias Bynens 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.
Comment 2 Tom Van Goethem 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
Comment 3 Alexey Proskuryakov 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.