NEW 275268
Geolocation permission state is not immediately reflected in the response of the permissions API, only after a page reload.
https://bugs.webkit.org/show_bug.cgi?id=275268
Summary Geolocation permission state is not immediately reflected in the response of ...
smoser
Reported 2024-06-07 12:34:22 PDT
I experimented with the permissions API WebKit implementation for geolocation on iOS and MacOS using [this testing site](https://permission.site/permission-status). I'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. "Access Status" reports `SUCCESS` 2. `navigator.permissions.query({ name: 'geolocation' })`, i.e. "Permission Status" reports `GRANTED` 3. When I reload the page, the permission status now reports `GRANTED` Observed behavior: 1. `navigator.geolocation.getCurrentPosition(...)`, i.e. "Access Status" reports `SUCCESS` 2. `navigator.permissions.query({ name: 'geolocation' })`, i.e. "Permission Status" 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.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-06-14 12:35:19 PDT
Note You need to log in before you can comment on or make changes to this bug.