browser.tabs is undefined in panel created by devtools.panels.create.
Categories
(WebExtensions :: Developer Tools, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: bwinton, Unassigned)
References
(Blocks 1 open bug)
Details
Updated•8 years ago
|
Comment 1•8 years ago
|
||
Updated•8 years ago
|
Updated•8 years ago
|
Updated•6 years ago
|
Comment 2•6 years ago
|
||
In order to simplify things about the messaging mess, I'm probably changing devtools contexts to receive message from content scripts in bug 1583484, so we should probably also change this behavior in the same firefox release.
Luca, can you please write a brief summary of what needs to be done here to expose full extension APIs to devtools contexts?
Comment 3•6 years ago
|
||
Follows a list of what needs to be done (I briefly double-checked these on searchfox and it should still be quite complete):
-
the
devtools_child/devtools_parentenv types are not currently listed in thescopesAPI registration property related to a number of API modules, and so we'll need to apply changes to the related files (which should be ext-browser.js, ext-browser.json, ext-toolkit.js, ext-toolkit.json) -
the extensions' devtools page and devtools panel contexts use a separate
SchemaAPIManagerinstance nameddevtoolsAPIManager(and defined here](https://searchfox.org/mozilla-central/rev/723e61e5f6fe36e69592b7742bc10338392e53e4/toolkit/components/extensions/ExtensionPageChild.jsm#140-157)), it also likely needs some changes to make sure that we will also provide access to the other APIs available to the other extension pages -
a good chunk of the changes originally introduced to prevent the content scripts message and ports to be received from the devtools pages (landed from Bug 1383310) has to be reverted (e.g. in particular the ones applied to the
Messengerclass, looking on searchfox for bug 1383310 and/or for this.excludeContentScriptSender should point us directly to them) -
some test cases (introduced by Bug 1383310) are currently checking that a devtools context doesn't receive messages and ports from a content script, and so we will need to change them to actually cover the new expected behavior (If I recall correctly the only test case should actually be this one)
Comment 4•3 years ago
|
||
Similarly, chrome.permissions/browser.permissions is undefined in the DevTools panel context in Firefox, but not Chromium.
Should Chrome incompatibilities be updated to include this difference in behaviour? My extension using chrome.tabs & chrome.permissions in a DevTools panel context works fine in Edge, Chromium, and Chrome; Firefox is the only outlier but there's no mention of APIs being completely unavailable in certain contexts vs those other browsers.
I noticed permissions missing before tabs, because the flow is to permissions.request and then use tabs.get to get the devtools.inspectedWindow.tabId tab so I can get its window and drawAttention/focus it so the user can see the prompt when DevTools is in an undocked window. Thought I'd mention permissions missing explicitly since this issue didn't show up easily when searching for permissions being undefined.
Updated•3 years ago
|
Description
•