Bug 258726
| Summary: | navigator.permissions.query for geolocation reporting wrong value | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Alexander Berner <a.berner> |
| Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | ap, cdumez, marcosc, rupin, thorsten, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 16 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 16 | ||
Alexander Berner
After denying the geolocation after calling navigator.geolocation.getCurrentPosition navigator.permissions.query({name: "geolocation"}) still reports "prompt" instead of denied.
Expected result would be "denied"
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
I think this may intentional, but CC'ing people who will know for certain.
Radar WebKit Bug Importer
<rdar://problem/111905576>
Alexander Berner
Any news if this is behavior is intentional?
Marcos Caceres
Sorry for the delay. I'm not sure if this is intentional. It should be intentional on initial load of a document, so to not reveal a user preference. However, after an explicit denial from the user, it should probably return "denied".
Luca Passariello
Hi, sorry to stick my nose in, but this is also the case for the opposite scenario. In the current version of Safari (on iOS 17.4.1) when requesting permission and accepting, the status never updates to granted. Even though you do not need to prompt again for the location.
It will update to granted if the user has their global setting as 'allow' instead of 'ask'.
rupin
Fixed in https://bugs.webkit.org/show_bug.cgi?id=293089!
*** This bug has been marked as a duplicate of bug 293089 ***
rupin
This is fixed in both cases now:
1. If the Geolocation API hasn't been used (so we haven't called "getCurrentLocation" or another one of it's functions), the Permissions API will return PROMPT.
2. If the Geolocation API has been used *within this page load*, the Permissions API will return GRANTED or DENIED depending on the user's response to the prompt.
3. If the page gets reloaded, this resets, so the Permissions API will once again return PROMPT.
You can see the full table of behavior and its explanation in this PR: https://github.com/WebKit/WebKit/pull/45470.
Thank you for reporting the bug and I hope this helps!