Allow the opening of a devtool panel

NEW
Unassigned

Status

P3
normal
3 years ago
2 months ago

People

(Reporter: andy+bugzilla, Unassigned)

Tracking

(Depends on: 1 bug, Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: triaged)

(Reporter)

Description

3 years ago
Allow an add-on to open the devtool panel programmatically. This was requested by adblock plus. I'll let Wladimir add some details of how/why.

Comment 1

3 years ago
We plan to use a devtool panel for our "blockable items" information which makes sense. However, users won't necessarily find/expect this functionality in the devtools. So ideally we would still have "Open blockable items" in the extension's menu - but for that the extension needs the ability to open its devtool panel programmatically (Chrome APIs don't allow that).

Updated

2 years ago
Priority: -- → P3
Whiteboard: triaged
(Reporter)

Comment 2

2 years ago
Luca, I think you had a prototype for this? Is this straightforward when the rest of devtools lands?
webextensions: --- → ?
Flags: needinfo?(lgreco)

Comment 3

2 years ago
(In reply to Andy McKay [:andym] from comment #2)
> Luca, I think you had a prototype for this? Is this straightforward when the
> rest of devtools lands?

yeah, I started to prototype it using a webextensions experiment (https://github.com/rpl/webext-experiment-devtools):

Opening the devtools toolbox on one of the existent devtools panels is pretty straightforward, what is going to be more tricky is to be able to select a custom devtools panel registered by an addon (even registered by the same addon that calls the proposed `openDevTools` API method).

The reason is that the "addon registered panel" doesn't exist until the addon devtools_page creates it (which should usually happen just after the devtools toolbox has been completely loaded, at least if the devtools page does not miss to create the panel for any reason, a bug or for intentional reasons).

One option here could be (once the toolbox is open) to wait for a short amount of time and switch to the first panel created by the addon that has opened the toolbox, if it has been registered, but if the addon fails to create its panel, it would be probably confusing for the users, because it would not be completely clear "why developer toolbox has been opened".

Given that this particular feature is not supported on Chrome, a better strategy could be:

- support an additional devtools_panel (or devtools_panels) property in the manifest, which will statically register a devtools_panel

- return a rejected promise from the `openDevTools` API method if the addon is trying to open the toolbox on a custom devtools panel that is not already registered (and do not open the toolbox at all in that case)
Flags: needinfo?(lgreco)
(Reporter)

Updated

2 years ago
webextensions: ? → ---

Updated

2 years ago
Depends on: 1370525

Updated

2 years ago
Duplicate of this bug: 1404416

Updated

9 months ago
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.