Open sohailrajdev97 opened 3 months ago
Thanks again for filing this @sohailrajdev97. On the Chrome side, we are supportive - we would prefer only a single new ContextType variant to avoid adding several. We should also work together to communicate the change to developers before it happens since it is a behavior change, even if adoption is low.
Looking forward to seeing this progress :)
I filed this bug on the Firefox side to implement DEVELOPER_TOOLS
in runtime.getContexts()
: https://bugzilla.mozilla.org/show_bug.cgi?id=1918719
Exposing developer tools contexts in runtime.getContexts() API
WECG proposal for
runtime.getContexts()
https://github.com/w3c/webextensions/blob/main/proposals/runtime_get_contexts.md
Background
Extensions can customize the browser developer tools. When an extension customises the developer tools, it can run code in the following contexts:
devtools.panels.create()
from the developer tools page (1).devtools.panels.<panel>.createSidebarPane()
from the developer tools page (1).Proposal
All the above contexts host extension content (HTML and JavaScript). These should be available in the results of
runtime.getContexts()
API.runtime.getContexts()
asynchronously returns a list ofExtensionContext
objects. Following is a description of howExtensionContext
’s fields would be populated for developer tools contexts.DEVTOOLS_PAGE
for developer tools page.DEVTOOLS_PANEL
for developer tools panel.DEVTOOLS_SIDEBAR_PANE
for developer tools sidebar pane.Other fields (contextId, documentId, frameId, documentUrl, documentOrigin, incognito) should be populated as expected. No special handling is needed for them.
Current support
Compatibility issues
Chrome already returns developer tools contexts via the API; some extensions might be using that information. Currently the contexts are returned with the “TAB” context type and that is a bug.
Creating this issue to get group's feedback. We will create a follow-up PR to modify the
runtime.getContexts()
proposal after we have consensus within the group.