From ac268f682d5023bd061e0fd7107c676fd43a9aad Mon Sep 17 00:00:00 2001 From: EnderDev Date: Sun, 17 Mar 2024 19:10:44 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20errors=20when=20unloading?= =?UTF-8?q?=20the=20browser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- actors/DotTooltipListenerChild.sys.mjs | 2 +- components/status/content/browser-status.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/actors/DotTooltipListenerChild.sys.mjs b/actors/DotTooltipListenerChild.sys.mjs index 4f9dc7dc70..51d0f13568 100644 --- a/actors/DotTooltipListenerChild.sys.mjs +++ b/actors/DotTooltipListenerChild.sys.mjs @@ -351,7 +351,7 @@ export class DotTooltipListenerChild extends JSWindowActorChild { // Check if we're in an active chrome window if ( !doc || - doc.ownerGlobal.browsingContext.isContent || + doc?.ownerGlobal.browsingContext.isContent || Services.focus.focusedWindow != win.top ) { return; diff --git a/components/status/content/browser-status.js b/components/status/content/browser-status.js index d47504b176..57856d1236 100644 --- a/components/status/content/browser-status.js +++ b/components/status/content/browser-status.js @@ -53,13 +53,17 @@ class BrowserStatusPanel extends BrowserContextualMixin(MozHTMLElement) { * Obtains the current status value */ getStatus() { + // Check if we have a contextual tab or browser + // before computing the status text. + if (!this.hostContext.tab || !this.hostContext.browser) return; + for (const statusType of this.STATUS_HIERARCHY) { // Special case for busy statuses: // Ensure the document is actually loading, // otherwise we just skip it. if ( statusType == "busy" && - !this.hostContext.browser.webProgress.isLoadingDocument + !this.hostContext.browser.webProgress?.isLoadingDocument ) { continue; }