Firefox 55 breaks extension debugger for background



a year ago
3 months ago


(Reporter: lauren.garcia, Unassigned)


55 Branch

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [debugger])



a year ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36

Steps to reproduce:

Have been working on a web extension ('s) and noticed in the upgrade from version 54.x to 55.x (on macosx at least) that the extension debugger for background process fails to reload nicely (as the 54.x version did). 

In the old version, you could ctrl-r in the background debugger and continue debugging after the reload with the fresh background process.

Another piece of possibly related info is that our webextension is considered "legacy" right now (have no idea if that has anything to do with it).

Actual results:

In version 55.0.2, when I do a ctrl-r to reload, i get this error: "Error: WebExtension context not found!  ExtensionParent.jsm:695:13" and it seems the debugger becomes disconnected from the background process. 

I also created a new profile and tested on the FF Nightly, which seems to exhibit same problem and what I think is same/similar error: "Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist.  ExtensionCommon.jsm:306"

Expected results:

I should be able to continue debugging an extensions' background process after hitting ctrl-r in extensions' background debugger.

Comment 1

a year ago
Also noticed just now: I can no longer click on the error message's file name + line number link to view code that has thrown error. The links below it in the stacktrace (if you click on arrow next to error msg to expand) no longer work either.
Component: Untriaged → Developer Tools: about:debugging


a year ago
Component: Developer Tools: about:debugging → WebExtensions: Developer Tools
Product: Firefox → Toolkit


a year ago
Flags: needinfo?(lgreco)
An hybrid legacy addon background page cannot be reached from the legacy Addon Debugger window, which only gives access to the bootstrap file sandbox, so my guess is that the reporter was inspecting the background page using the Browser Toolbox, by selecting the background page from the frame selector.

And so, I reproduced the issue locally by:
- opening the Browser Toolbox
- installing the's hybrid extension from "about:debugging#addons"
- selecting the background page from the Browser Toolbox frame selector 
- and finally pressing Ctrl-R.

Pressing the Ctrl-R shortcut in the Browser Toolbox while inspecting the background page is like executing "window.location.reload()" on the background page instead of reloading the entire addon, which I'm pretty sure that could lead to a number of unwanted (and unexpected) side effects (e.g. there are UI elements like the contextMenus items that are only removed when the addon is shutting down, and so if these API is used in the reloaded background page, there will be duplicated items).

The Error messages mentioned in Comment 0 do not seem to be related to something that is breaking in the Browser Toolbox itself, but more like some of the assumptions in the WebExtensions internals that are not true anymore when the background page has been reloaded without reloading the entire addon.

I also tried to reload the "Reload" button from the "about:debugging#addons" instead of the Ctrl-R shortcut and the extensions seems to be able to restart correctly, and the Browser Toolbox seems to be still attached correctly (e.g. with a breakpoint set on the background page, I've got the debugger panel to automatically pause the background page on that line while the addon is reloading), unfortunately the Browser Toolbox will switch automatically to the main privileged context, the XUL window, when the background page has been destroyed and so the background page has to be manually selected from the frame selector again.

Do you mind trying to reload the entire hybrid addon as described above and check that extension works correctly after the reload and that debugging / inspecting the addon resources from the Browser Toolbox is still working? 
(besides any other errors that could have been logged in the console and not strictly related to your extension, and the need to select the background page from the Browser Toolbox's frames selector).
Flags: needinfo?(lgreco) → needinfo?(lauren.garcia)

Comment 3

a year ago
Since this only seems to affect embedded extensions and they won't be valid in Firefox 57, we've run out of time on this for 56. I can see scenarios in Nightly where this might come in useful though.
status-firefox57: --- → wontfix
Priority: -- → P5
Whiteboard: [debugger]

Comment 4

a year ago
Sorry for lag on my end -- Luca: yes, reloading entire hybrid addon works. It's just the ctrl-r from debugger console that doesn't work, sounds like for the reasons you mention. It's just a nice workflow thing; it's annoying to stop and reload from outside of debugger window.

And yes, agree with Andy that it's probably not important for legacy extensions on FF <57 at this point but do keep it in mind in the future.
Flags: needinfo?(lauren.garcia)


6 months ago
Product: Toolkit → WebExtensions
status-firefox57: wontfix → ---
You need to log in before you can comment on or make changes to this bug.