Open Bug 1698068 Opened 4 years ago Updated 2 years ago

Extension content scripts are not listed in the debugger panel when devtools.chrome.enabled is false

Categories

(DevTools :: Debugger, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: rpl, Unassigned)

References

(Blocks 1 open bug)

Details

What were you doing?

As currently documented in our addon debugging doc page here: https://extensionworkshop.com/documentation/develop/debugging/#debugging-content-scripts

to be able to debug an extension content script the extension developers (or users interested in debugging their installed extensions) are expected to see the extension content scripts injected in a particular tab listed in the debugger panel (along with the other scripts executed in that same tab, but under a section of the outline tree specifically related to the extension that has rejected the content script).

At the moment that behavior is controlled by the devtools advanced setting "Enable browser chrome and add-on debugging toolboxes" (which correspond to the devtools.chrome.enabled about:config preference), by default it is disabled and the content scripts are not listed in the debugger panel.

Steps to reproduce:

  1. Install an extension that injects content scripts (e.g. Dark Reader)
  2. Load a webpage (e.g. a github repo page) in a new tab
  3. Open the devtools toolbox on the new tab and select the debugger panel

What happened?

The Dark Reader extension (and its content scripts) are not listed in the debugger panel outline, and there is not visible clue that would suggest the user that they would need to enable a setting to see them listed.

The current behavior may be very likely confusing for the Firefox users that specifically want to debug a content script and they may more likely report it as a bug (or not reporting it but still assume that it is not working).

What should have happened?

The extension content scripts should be either listed by default or we could at least provide a more visible way to make them visible.

I think that I may agree that listing the extensions content scripts by default may be a little distracting to the web developers that are not interested in them at all, but having a more visible toggle in the debugger panel may make this less confusing to the users that are specifically interested in debugging content scripts.

Anything else we should know?

  • As a side-effect of setting devtools.chrome.enabled to true, the debugger panel is not only going to list the extension content scripts, but also Firefox internals that were being executed as part of the content script injection (in particular ExtensionContent.jsm will be very likely always be listed along with the extension content scripts for this reason).

    • The addons developers would not be usually be interested in seeing these internals listed and they may just be confusing for them.
    • It may be reasonable to split a pref related to listing extensions content scripts in the panel from the one used to enable debugging Firefox internals in those developer toolboxes.
  • This issue is kind of an enhancement because the feature does actually work, but the fact that is not easy for the user to figure out which settings is preventing them to debug the content script may be also considered a defect.

  • While we evaluate how we could improve this, I'm going to update our doc page linked above to point out the current behavior to the user that gets to this doc page.

Thanks for the report Luca.

I like the idea of having more visible way to toggle Extension and/or Chrome debugging on/off

Also, I can reproduce all on my machine (Win10, FxNightly). I have to have Fission off to see the ExtensionContent.jsm file

Honza

Blocks: dbg-addon
Severity: -- → S3
Has STR: --- → yes
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.