RESOLVED CONFIGURATION CHANGED 133648
First assignment to [Replaceable] navigator.geolocation is ignored
https://bugs.webkit.org/show_bug.cgi?id=133648
Summary First assignment to [Replaceable] navigator.geolocation is ignored
Daniel Bates
Reported 2014-06-09 11:01:47 PDT
Attachment #232707 [details] for bug #133559 marks attribute navigator.geolocation as [Replaceable]. As mentioned in bug #133559, comment 14, the tests included in this attachment don't pass "because the first assignment to an instance attribute called geolocation that shadows navigator.geolocation is ignored." Marking attribute navigator.geolocation as [Replaceable] should make it replaceable and hence the first assignment to an instance attribute that shadows navigator.geolocation should take effect. You can observe this issue by following the steps in bug #133559, comment 15, reproduced here: You can see this issue by applying the patch, attachment #232707 [details], and [opening] the following URL in Safari linked against the built WebKit: data:text/html,<script>'use strict'; var MyNavigator = function() {}; MyNavigator.prototype = window.navigator; var myNavigator = new MyNavigator(); myNavigator.geolocation = 1; alert(myNavigator.geolocation);</script> Then the alert message text is "[object Geolocation]" (*). But should be "1". Modify the above URL to assign some arbitrary value to myNavigator.geolocation, say the string literal "dummy", before the statement that assigns 1 to it, such that it reads: data:text/html,<script>'use strict'; var MyNavigator = function() {}; MyNavigator.prototype = window.navigator; var myNavigator = new MyNavigator(); myNavigator.geolocation = 'dummy'; myNavigator.geolocation = 1; alert(myNavigator.geolocation);</script> Open this URL. Then the alert message reads "1" as expected. (*) I noticed that executing a similar script directly in the Web Inspector console will cause the alert message text to read "1" as expected (why?).
Attachments
Alexey Shvayka
Comment 1 2022-11-29 06:59:22 PST
As of 2022, WebKit implements navigator.geolocation as readonly attribute, w/o [Replaceable], per spec (https://www.w3.org/TR/geolocation/#navigator_interface). The readonly-ness is covered by WPT's idlharness.js.
Note You need to log in before you can comment on or make changes to this bug.