From f5a1c69295bca579399cbb34fb21a988d2f76a10 Mon Sep 17 00:00:00 2001 From: Paul Zuehlcke Date: Thu, 16 Dec 2021 16:38:54 +0000 Subject: [PATCH] Bug 1745959 - Do not fall back to selected browser in TabDialogBox getter. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D133778 --- browser/base/content/tabbrowser.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 4f2bde31c3ab..8c6c4d382e58 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -866,11 +866,13 @@ }, getTabDialogBox(aBrowser) { - let browser = aBrowser || this.selectedBrowser; - if (!browser.tabDialogBox) { - browser.tabDialogBox = new TabDialogBox(browser); + if (!aBrowser) { + throw new Error("aBrowser is required"); } - return browser.tabDialogBox; + if (!aBrowser.tabDialogBox) { + aBrowser.tabDialogBox = new TabDialogBox(aBrowser); + } + return aBrowser.tabDialogBox; }, getTabFromAudioEvent(aEvent) {