Closed Bug 1752141 Opened 4 years ago Closed 4 years ago

Temporary Geolocation permission is per-request, causing unexpected behavior of the permissions API (was: PermissionStatus.onchange not called when temporarily allowing geolocation request)

Categories

(Firefox :: Site Permissions, defect)

Firefox 96
defect

Tracking

()

RESOLVED DUPLICATE of bug 1719651

People

(Reporter: gcompanionib, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36

Steps to reproduce:

First of all, I open this bug in the github repository of navigator geolocation API.
https://github.com/w3c/geolocation-api/issues/117

The point is that if I don´t click the remember my decision check box, the navigator geolocation API doesn´t react, it is like if the user handn´t do anything.

Actual results:

Results are that after select block or allow without clicking the remember my decision check box, the navigator geolocation API doesn´t detect it. I already opened this issue in this API repo as I referenced before but they told me this bug was related to Mozilla

Expected results:

The navigator geolocation API should detect when I click on any option without selecting the remember my decision check box

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

Can you attach a test-case that shows the issue please? Ideally a standalone html file that requests the permission so that we can reproduce exactly what you're seeing?

Thank you!

Flags: needinfo?(gcompanionib)

Sorry for the delay, I have been pretty bussy this week. Here you have the deplyed app where you can see this issue:

https://location-test.elc0mpa.me/

And just in case you would like to verify the code, here you have the repository:

https://github.com/elC0mpa/geolocation-test

Anything you need please let me know, thanks in advance

Flags: needinfo?(gcompanionib)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Problem with navigator.geolocation api when granted temporarily access in Mozilla → PermissionStatus.onchange not called when temporarily allowing geolocation request.

Thanks for the test-case! I simplified it a bit and turned it into a standalone html page above, that's super helpful. I can reproduce it.

I can try to take a look when I have some time though if someone from the DOM team figures out sooner that'd be great.

Blocks: 1105827
Flags: needinfo?(emilio)

Ah, so I think this working as expected given what our current permission prompt for geolocation does.

When you get "prompt" then that's only saying that the next geolocation request will trigger a prompt. When you click on "Allow" on the geolocation popup, we only allow that specific request, and do not persist the permission during the session, which seems a bit unexpected because we keep showing the geolocation icon...

But the point is, the status of the permission hasn't changed. Next time you trigger a geolocation request, you'll get another prompt. You can see this trivially on the test-case, if you click the button above.

Generally, I think it'd be more intuitive with the rest of the UI (and the behavior would be closer to what developers expect per comment 0) if this code would not only grant the given request, but also perhaps allow or deny the per-session permission... Mike, do you know who owns the permissions UI?

Component: DOM: Core & HTML → Site Permissions
Flags: needinfo?(emilio) → needinfo?(mconley)
Product: Core → Firefox
Summary: PermissionStatus.onchange not called when temporarily allowing geolocation request. → Temporary Geolocation permission is per-request, causing unexpected behavior of the permissions API (was: PermissionStatus.onchange not called when temporarily allowing geolocation request)

I usually ask pbz about site permission things.

Flags: needinfo?(mconley) → needinfo?(pbz)

Chrome and Firefox differ in behavior here. While Chrome grants a persistent geolocation permission when the user accepts the prompt, Firefox only gives the website a one-off grant. Since it's a one-off grant for a specific geolocation request, it is not reflected in the Permissions API.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #7)

Generally, I think it'd be more intuitive with the rest of the UI (and the behavior would be closer to what developers expect per comment 0) if this code would not only grant the given request, but also perhaps allow or deny the per-session permission... Mike, do you know who owns the permissions UI?

If the geolocation request is denied by the user, we remember that choice for the lifetime of that browser/tab to prevent sites from spamming requests. We don't hand out temporary grants, here is the original reasoning: https://searchfox.org/mozilla-central/diff/95370d69a3d04d6a332b2067bbacfb90bc465206/browser/modules/SitePermissions.jsm#395-402
Since Bug 1693621 we do support temporary grants and use it for the WebRTC permissions. We could consider doing this for geolocation too now that it's covered by the Permissions Policy.

There is a bug about exposing temporary permission states via the Permission API, but I can't find it right now.

Flags: needinfo?(pbz)

(In reply to Paul Zühlcke [:pbz] from comment #9)

There is a bug about exposing temporary permission states via the Permission API, but I can't find it right now.

Found it! I'll file a separate bug for handing out temporary permission grants too.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
See Also: → 1754005

So is this finaly solved?
How could I verify this? Is any version which I could download to test this?

(In reply to José Gabriel Companioni Benítez from comment #11)

So is this finaly solved?
How could I verify this? Is any version which I could download to test this?

I've marked this bug as a duplicate of Bug 1754005. That bug is still open, so there is nothing to test at this point.

(In reply to Paul Zühlcke [:pbz] from comment #12)

(In reply to José Gabriel Companioni Benítez from comment #11)

So is this finaly solved?
How could I verify this? Is any version which I could download to test this?

I've marked this bug as a duplicate of Bug 1754005. That bug is still open, so there is nothing to test at this point.

Thanks my friend

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: