tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 0eee6df69d17737364d676dfa903fe6722dc6e62
parent 461b86ef9b9cea9379e77c77969556de566971b6
Author: Julian Descottes <jdescottes@mozilla.com>
Date:   Wed,  3 Dec 2025 17:02:50 +0000

Bug 2002893 - [devtools] Guard against missing docShell in document-events listener r=devtools-reviewers,nchevobbe

This guard might avoid some toolbox initialization errors, but note that if we are in the process of starting a toolbox against a window which is being destroyed we might still stumble at a later step.

I manage to reproduce this once manually, over hundreds of attempts, so it's hard to validate the fix.

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

Diffstat:
Mdevtools/server/actors/webconsole/listeners/document-events.js | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/devtools/server/actors/webconsole/listeners/document-events.js b/devtools/server/actors/webconsole/listeners/document-events.js @@ -109,6 +109,12 @@ DocumentEventsListener.prototype = { return; } + if (!window.docShell) { + // Bail out if the window is being destroyed and the docShell cannot be + // retrieved anymore. + return; + } + const time = this._getPerformanceTiming(window, "navigationStart"); this.emit("dom-loading", {