Call to requestStorageAccess() having a granted "storage-access" permission fails
Categories
(Core :: Privacy: Anti-Tracking, defect, P2)
Tracking
()
People
(Reporter: esroyo, Assigned: bvandersloot)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0
Steps to reproduce:
According to the MDN docs [0], when we query for "storage-access" permissions and it resolves to an state of "granted", It should be possible to directly call document.requestStorageAccess()
without user interaction. However, I get an error on that scenario.
const permission = await navigator.permissions.query({
name: "storage-access",
});
if (permission.state === "granted") {
// If so, you can just call requestStorageAccess() without a user interaction,
// and it will resolve automatically.
// But this throws...
await document.requestStorageAccess();
}
I have prepared a demo to reproduce the case:
https://esroyo.github.io/storage-access-api-firefox/
1 . On a first visit permission.state
has a value of "prompt", thus need user interaction. User grants permission. All ok.
2. On a second visit permission.state
has a value of "granted", thus we should be able to call document.requestStorageAccess()
without user interaction. If we try so, then we get the error.
Actual results:
Even though permission query resolve to state="granted", a call to document.requestStorageAccess()
throws:
document.requestStorageAccess() may only be requested from inside a short running user-generated event handler.
DOMException: requestStorageAccess not allowed
Expected results:
It should not throw.
Situation on a first load of the demo site, just after user has been prompted and accepted to grant access.
Situation on a second load, after having a result of state="granted" and calling document.requestStorageAccess()
without user interation.
Comment 3•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Privacy: Anti-Tracking' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•1 year ago
|
Assignee | ||
Comment 4•1 year ago
|
||
This will be resolved with Fx119, due to Bug 1837168 being resolved.
You can confirm with the latest Nightly or Beta release of Firefox that this is no longer observed.
I confirm the problem has been solved on Firefox 119.
Thanks a lot @bvandersloot and everyone.
Regards.
Description
•