<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>133648</bug_id>
          
          <creation_ts>2014-06-09 11:01:47 -0700</creation_ts>
          <short_desc>First assignment to [Replaceable] navigator.geolocation is ignored</short_desc>
          <delta_ts>2022-11-29 06:59:22 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Bindings</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Daniel Bates">dbates</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ashvayka</cc>
    
    <cc>ggaren</cc>
    
    <cc>mhahnenberg</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1014144</commentid>
    <comment_count>0</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2014-06-09 11:01:47 -0700</bug_when>
    <thetext>Attachment #232707 for bug #133559 marks attribute navigator.geolocation as [Replaceable]. As mentioned in bug #133559, comment 14, the tests included in this attachment don&apos;t pass &quot;because the first assignment to an instance attribute called geolocation that shadows navigator.geolocation is ignored.&quot; 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, and [opening] the following URL in Safari linked against the built WebKit:
data:text/html,&lt;script&gt;&apos;use strict&apos;; var MyNavigator = function() {}; MyNavigator.prototype = window.navigator; var myNavigator = new MyNavigator(); myNavigator.geolocation = 1; alert(myNavigator.geolocation);&lt;/script&gt;

Then the alert message text is &quot;[object Geolocation]&quot; (*). But should be &quot;1&quot;. Modify the above URL to assign some arbitrary value to myNavigator.geolocation, say the string literal &quot;dummy&quot;, before the statement that assigns 1 to it, such that it reads:

data:text/html,&lt;script&gt;&apos;use strict&apos;;  var MyNavigator = function() {}; MyNavigator.prototype = window.navigator; var myNavigator = new MyNavigator(); myNavigator.geolocation = &apos;dummy&apos;; myNavigator.geolocation = 1; alert(myNavigator.geolocation);&lt;/script&gt;

Open this URL. Then the alert message reads &quot;1&quot; as expected.

(*) I noticed that executing a similar script directly in the Web Inspector console will cause the alert message text to read &quot;1&quot; as expected (why?).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1915286</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Shvayka">ashvayka</who>
    <bug_when>2022-11-29 06:59:22 -0800</bug_when>
    <thetext>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&apos;s idlharness.js.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>