Closed
Bug 1440668
Opened 7 years ago
Closed 7 years ago
activeTab permission does not work inside menus.onShown callback
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: dalokmarcinak, Unassigned)
Details
(Whiteboard: design-decision-needed)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20171024165158
Steps to reproduce:
Created a webextension containing the following code in a background script:
browser.menus.onShown.addListener(async (info, tab) => {
const selection = await browser.tabs.executeScript({
code: ''document.getSelection();"
});
console.log(selection);
}
});
The extension does request the "activeTab" permission in manifest.json.
Actual results:
The debugger indicates that at the executeScript() call, an exception was thrown with the message "Error: Missing host permission for the tab"
I believe that the onShown callback falls under "the user interacting with the extension" and therefore the activeTab permission should allow this case.
Expected results:
The current selection is logged to the console.
Updated•7 years ago
|
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
Comment 1•7 years ago
|
||
I'm skeptical about this, this event can be triggered just by hovering over an extension's context menu entry which I would not describe as a deliberate interaction with the extension.
Whiteboard: design-decision-needed
For context, the extension which I'm porting is
https://addons.mozilla.org/en-US/firefox/addon/gtranslate/
which translates the selected text when you open its context menu submenu, and displays the translation in a menu item.
On the other hand, after I opened this bug, selectionText was added to the info object received by the event handler, so for this use case the permission is no longer needed.
Updated•7 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Updated•7 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•