chrome.permissions.request needs to be called directly from input handler, making it impossible to check for permissions first
Categories
(WebExtensions :: Compatibility, defect, P3)
Tracking
(Not tracked)
People
(Reporter: aleks.dimitrov, Unassigned)
References
Details
(Whiteboard: [permissons])
Updated•7 years ago
|
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
Reporter | ||
Comment 3•7 years ago
|
||
Updated•7 years ago
|
Updated•6 years ago
|
Comment 6•6 years ago
|
||
Updated•6 years ago
|
i can confirm aleks' comments from three years ago while working with 74.0b9:
-
checking whether url(!) permissions are granted via chrome.permissions.contains beforehand cause the infamuous
'permissions.request may only be called from a user input handler' -
calling chrome.permissions.request straight for urls works as expected... in google chrome - chrome recognizes that the permission has already been granted when declared in manifest.json#permissions. at its current stage – 74.0b9 – firefox makes me declare the same permission in optional_permissions or it won't grant it; in some situations this requires the use of <all_urls> – something we certainly try to avoid – since we cannot foresee which sites the user may want to access.
may i ask to put this on higher priority?
Comment 8•5 years ago
|
||
(In reply to tom from comment #7)
i can confirm aleks' comments from three years ago while working with 74.0b9:
- checking whether url(!) permissions are granted via chrome.permissions.contains beforehand cause the infamuous
'permissions.request may only be called from a user input handler'
Not true. The contains
method can unconditionally be called.
- calling chrome.permissions.request straight for urls works as expected... in google chrome - chrome recognizes that the permission has already been granted when declared in manifest.json#permissions. at its current stage – 74.0b9 – firefox makes me declare the same permission in optional_permissions or it won't grant it; in some situations this requires the use of <all_urls> – something we certainly try to avoid – since we cannot foresee which sites the user may want to access.
Requiring a permission to be matched by a value in optional_permissions before it can be requested as an optional permission looks like intended behavior.
The fact that an optional permission is not prompted for if there is already a matching mandatory permission is a bug that tracked at bug 1502987.
may i ask to put this on higher priority?
The current priority looks about right. There is no need to call contains() before request, and removing that call resolves the issue.
Extending the lifetime of the user interaction is somewhat risky, because it can be abused to extend the user interaction for (much) longer than desired.
(In reply to Rob Wu [:robwu] from comment #8)
- checking whether url(!) permissions are granted via chrome.permissions.contains beforehand cause the infamuous
'permissions.request may only be called from a user input handler'Not true. The
contains
method can unconditionally be called.
sorry, i wasn't clear enough: a subsequent call to #request causes the error above, not the call to #contains itself
- calling chrome.permissions.request straight for urls works as expected... in google chrome - chrome recognizes that the permission has already been granted when declared in manifest.json#permissions. at its current stage – 74.0b9 – firefox makes me declare the same permission in optional_permissions or it won't grant it; in some situations this requires the use of <all_urls> – something we certainly try to avoid – since we cannot foresee which sites the user may want to access.
Requiring a permission to be matched by a value in optional_permissions before it can be requested as an optional permission looks like intended behavior.
even if we have to maintain it in both permissions and optional_permissions in manifest.json?
The fact that an optional permission is not prompted for if there is already a matching mandatory permission is a bug that tracked at bug 1502987.
ah, thank you. so i guess that one needs higher prio ;)
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 11•2 years ago
|
||
The severity field for this bug is relatively low, S4. However, the bug has 3 duplicates.
:rpl, could you consider increasing the bug severity?
For more information, please visit auto_nag documentation.
Updated•2 years ago
|
Comment 12•2 years ago
|
||
We discussed about this bug in a pretty recent triage and agreed on setting it as an S4, the duplicates were already known at that time, and so we will keep the S4 set for now.
(But there is still works ongoing around the changes to host permissions behaviors in manifest_version 3 and so I added it as a SeeAlso to the related tracking bug, as something to keep it in mind and consider to bump in priority).
Comment 13•2 years ago
|
||
Inability to call any async function before permission request sounds like a serious obstacle on the route to manifest v3 and service worker.
Consider an add-on that declares some optional permissions and specific permission required to complete user actions depends on configuration. Non-persistent background page or service worker may be unloaded any time. Since browser.storage.local.get()
is an async method, it is impossible to conditionally request optional permission from browser.action.onClicked
handler. With persistent background page it is not an issue since configuration may be fetched from storage on extension load, so it is almost certainly ready in user action handlers.
I just confirmed the issue with "manifest_version": 3
in Firefox-109. I can post a tiny demo add-on.
Description
•