Permission requesting popup is unexpectedly bound to the context tab instead of the active tab when permissions.request() is called from the context menu on a background tab
Categories
(WebExtensions :: General, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: yuki, Assigned: yuki)
References
(Blocks 2 open bugs)
Details
Attachments
(2 files)
The permission requesting popup looks to be bound to the context tab instead of the active tab, even if the requested permission is not related to a specific website (e.g. bookmarks). This causes a non-intuitive result when we request a permission from the tab context menu.
Steps to reproduce
- Start Firefox.
- Open multiple tabs in a window.
- Go to
about:debugging. - Load the attached
testcase.xpias a temporary extension. - Right-click on a background tab.
- Choose "Request Permission".
Actual result
- Nothing happens. The permission requesting popup does not appear.
- When I close the context menu and activate the background tab, the permission requesting popup appears for the tab.
Expected result
- The permission requesting popup appears immediately.
Environment
- Nightly 85.0a1 (build id: 20201130215246) on Windows 10 Pro 20H2
- Firefox 83.0 (build id: 20201126174332) on ArchLinux
Compatibility note
Google Chrome doesn't support contexts:['tab'] type context menu, so this is quite Firefox specific issue.
| Assignee | ||
Comment 1•5 years ago
|
||
Codes binding to the permission prompt to the context tab instead of the active tab:
https://searchfox.org/mozilla-central/rev/0d6e8b21569f93a1e1ae8e377ab10f43a6cb12c1/toolkit/components/extensions/parent/ext-permissions.js#71
https://searchfox.org/mozilla-central/rev/0d6e8b21569f93a1e1ae8e377ab10f43a6cb12c1/browser/components/extensions/parent/ext-menus.js#1340
The method to show the permission prompt:
https://searchfox.org/mozilla-central/rev/0d6e8b21569f93a1e1ae8e377ab10f43a6cb12c1/browser/modules/ExtensionsUI.jsm#365
https://searchfox.org/mozilla-central/rev/0d6e8b21569f93a1e1ae8e377ab10f43a6cb12c1/toolkit/modules/PopupNotifications.jsm#534
It requires a browser to bind the prompt.
This design looks to be based on a usecase for permissions requested from webpages, e.g. geolocation. Non-host permissions look to unmatch to this design. I think it needs to be redesigned for such non-host permissions.
| Assignee | ||
Comment 2•5 years ago
|
||
Or, binding the prompt to the active tab instead of the context tab looks solve this bug. This plan is simpler than a fundamental fix I thought at the previous comment.
| Assignee | ||
Comment 3•5 years ago
|
||
Updated•5 years ago
|
Comment 4•5 years ago
|
||
(In reply to YUKI "Piro" Hiroshi from comment #1)
This design looks to be based on a usecase for permissions requested from webpages, e.g. geolocation. Non-host permissions look to unmatch to this design. I think it needs to be redesigned for such non-host permissions.
The pendingEventBrowser design is based on the assumption that the user interaction that counts towards the user interaction requirement of permissions.request is related to the browser. This works for the pageAction/browserAction button, and several context menus (in content areas in a tab, pageAction/browserAction popup, etc). It doesn't work well when the <browser> isn't the (active) tab browser, such as in this bug, where the <browser> can be any background tab, or bug 1493396, where the <browser> is in a sidebar.
I think that the best way to fix this specific bug is to update ext-menus.js, to not call withPendingBrowser for menu events that are unrelated to content.
PS. There have been several bugs related to the tracking of <browser>. See https://bugzilla.mozilla.org/show_bug.cgi?id=1433292#c14 for a list of bugs, to see what potential issues can be faced with the implementation of it.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
| Comment hidden (off-topic) |
Comment 6•3 years ago
|
||
Sorry, there was a problem with the detection of inactive users. I'm reverting the change.
Description
•