Closed Bug 1598364 Opened 3 years ago Closed 3 years ago

The browser toolbox inspector breaks when the browser window reloads


(DevTools :: Inspector, defect)

Not set


(firefox72 fixed)

Firefox 72
Tracking Status
firefox72 --- fixed


(Reporter: ochameau, Assigned: ochameau)


(Blocks 1 open bug)



(1 file)


  • Open the Omniscient Browser Toolbox
  • Open the inspector
  • Open the split console
  • execute location.reload()

many exception and the markup view is broken. The markup is outdate and selecting any element doesn't update the sidebar.

the markup view is updated and works against the new browser.xhtml document.

This isn't trivial and it looks like it has always been somewhat broken.

It relates to this code:

    const handler = getDocShellChromeEventHandler(docShell);
    handler.addEventListener("DOMWindowCreated", this._onWindowCreated, true);

The inspector looks more broken than the others because it doesn't receive any "new root"
this.walker.on("new-root", this.onNewRoot); which allows to re-populate the markup-view
That's because we don't emit window-ready:
targetActor.on("window-ready", this.onFrameLoad);
And the window-ready are a translationg of DOMWindowCreated events:
this._targetActor._windowReady(window, { isBFCache });

So. The issue here is that, in the context of the browser toolbox and the ParentProcessTargetActor, getDocShellChromeEventHandler(docShell) return the current browser.xhtml window object. It watches correctly all children documents/windows of this current browser window, but not the other windows, nor the next window in case of reload or navigation.
We would need to reattach the DOMWindowCreated listener on the next window on reload and navigation, as well as fire a window-ready in case of reload/navigation of the top level window.
Unfortunately, the docShell isn't destroyed, otherwise this code would have fixed this issue:

Blocks: browser-toolbox
No longer blocks: dt-fission-inspector

In the context of the browser toolbox, the ParentProcessTarget Actor watches
all top level window's docshells. But as it registers DOMWindowCreated/pageshow/pagehide
listeners against the docshell's window (because there is no parent chromeEventListener),
it has to ensure re-registering these listeners on navigation.

Assignee: nobody → poirot.alex
Pushed by
Re-register DOMWindowCreated listeners when reloading browser.xhtml. r=jdescottes
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72
QA Whiteboard: [qa-72b-p2]
You need to log in before you can comment on or make changes to this bug.