Bug 1598364 - Re-register DOMWindowCreated listeners when reloading browser.xhtml. r=jdescottes

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.

Differential Revision: https://phabricator.services.mozilla.com/D54193

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-11-22 10:18:22 +00:00
Родитель d539b6af15
Коммит 59f821be92
2 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -673,6 +673,12 @@ Toolbox.prototype = {
},
_stopThreadFrontListeners: function(threadFront) {
// Only cleanup thread listeners if it has been attached.
// We may have closed the toolbox before it attached, or
// we may not have attached to the target at all.
if (!threadFront) {
return;
}
threadFront.off("paused", this._onPausedState);
threadFront.off("resumed", this._onResumedState);
},

Просмотреть файл

@ -1666,6 +1666,22 @@ DebuggerProgressListener.prototype = {
this._knownWindowIDs.delete(innerID);
this._targetActor._windowDestroyed(window, innerID);
}
// Bug 1598364: when debugging browser.xhtml from the Browser Toolbox
// the DOMWindowCreated/pageshow/pagehide event listeners have to be
// re-registered against the next document when we reload browser.html
// (or navigate to another doc).
// That's because we registered the listener on docShell.domWindow as
// top level windows don't have a chromeEventHandler.
if (
this._watchedDocShells.has(window) &&
!window.docShell.chromeEventHandler
) {
// First cleanup all the existing listeners
this.unwatch(window.docShell);
// Re-register new ones. The docShell is already referencing the new document.
this.watch(window.docShell);
}
}, "DebuggerProgressListener.prototype.observe"),
onStateChange: DevToolsUtils.makeInfallible(function(