<?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>275268</bug_id>
          
          <creation_ts>2024-06-07 12:34:22 -0700</creation_ts>
          <short_desc>Geolocation permission state is not immediately reflected in the response of the permissions API, only after a page reload.</short_desc>
          <delta_ts>2025-08-14 09:24:32 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>Safari 17</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 14</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=275479</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=275950</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>smoser</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cdumez</cc>
    
    <cc>marcosc</cc>
    
    <cc>rupin</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2040371</commentid>
    <comment_count>0</comment_count>
    <who name="">smoser</who>
    <bug_when>2024-06-07 12:34:22 -0700</bug_when>
    <thetext>I experimented with the permissions API WebKit implementation for geolocation on iOS and MacOS using [this testing site](https://permission.site/permission-status). I&apos;m in particular interested in the behavior for “remembered” granted states. So I tried the following steps in MacOS:

1. Enable Location Services in settings
2. Enable Location Services for Safari in settings
3. Get a geolocation prompt 
4. Tick the [Remember my decision for one day] checkbox
5. Click [Allow]

Expected behavior

1. `navigator.geolocation.getCurrentPosition(...)`, i.e. &quot;Access Status&quot; reports `SUCCESS`
2. `navigator.permissions.query({ name: &apos;geolocation&apos; })`, i.e. &quot;Permission Status&quot; reports `GRANTED`
3. When I reload the page, the permission status now reports `GRANTED`

Observed behavior:

1. `navigator.geolocation.getCurrentPosition(...)`, i.e. &quot;Access Status&quot; reports `SUCCESS`
2. `navigator.permissions.query({ name: &apos;geolocation&apos; })`, i.e. &quot;Permission Status&quot; still reports `PROMPT`
3. When I reload the page, the permission status now reports `GRANTED`

We want to provide a consistent end-to-end experience between content-area UI and browser-side UX. To do that, we need to understand how the browser UX will behave if (for example) we call the browser’s geolocation API -- will a permission prompt be shown? Or is the permission already granted or denied?

The permission API should return `GRANTED` if and only if getCurrentPosition() will not be blocked by permissions framework.

We can then adjust our content-area UI to tailor nicely with the browser-side UX, which is inferred from the returned permissions status from the `query()` API, and the associated semantics [outlined here](https://w3c.github.io/permissions/#permissions). For this reason, it is critical for us that we can rely, across all browsers, on the returning the fresh state, without necessitating reloads.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2041430</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-06-14 12:35:19 -0700</bug_when>
    <thetext>&lt;rdar://problem/129867643&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2136458</commentid>
    <comment_count>2</comment_count>
    <who name="">smoser</who>
    <bug_when>2025-08-14 05:02:43 -0700</bug_when>
    <thetext>After some more testing, we found that this is only a limitation of the change event API outlined at https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus/change_event. The returned value from navigator.permissions.query behaves as expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2136486</commentid>
    <comment_count>3</comment_count>
    <who name="">rupin</who>
    <bug_when>2025-08-14 09:18:42 -0700</bug_when>
    <thetext>Thank you for filling the bug! Yes, the Permissions API onchange event is not fully supported, so this is expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2136490</commentid>
    <comment_count>4</comment_count>
    <who name="">rupin</who>
    <bug_when>2025-08-14 09:24:32 -0700</bug_when>
    <thetext>We are aware of this issue and so this bug should remain open/unresolved for now.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>