From 0f6f331d01dcf783b6c5c504ec4b2370b231765f Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sun, 4 Aug 2019 19:48:44 -0400 Subject: tabbrowser.xml: Add a null check to aBrowser and fix a few spurious whitespace and commas Without the null check aWindow can error because addons can call the fast path and not have a window due to race conditions. --- base/content/tabbrowser.xml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/base/content/tabbrowser.xml b/base/content/tabbrowser.xml index 4d0d783..72db9c9 100644 --- a/base/content/tabbrowser.xml +++ b/base/content/tabbrowser.xml @@ -371,11 +371,13 @@ // directly from the content window to the browser without looping // over all browsers. if (!gMultiProcessBrowser) { - let browser = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIDocShell) - .chromeEventHandler; - return this.getTabForBrowser(browser); + if (aWindow) { + let browser = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell) + .chromeEventHandler; + return this.getTabForBrowser(browser); + } } for (let i = 0; i < this.browsers.length; i++) { @@ -1596,7 +1598,7 @@ ownerTab: owner, skipAnimation: multiple, allowThirdPartyFixup: aAllowThirdPartyFixup, - postData: aPostDatas[0], + postData: aPostDatas[0] }); if (aNewIndex !== -1) { this.moveTabTo(firstTabAdded, aNewIndex); @@ -1609,7 +1611,7 @@ let tab = this.addTab(aURIs[i], { skipAnimation: true, allowThirdPartyFixup: aAllowThirdPartyFixup, - postData: aPostDatas[i], + postData: aPostDatas[i] }); if (targetTabIndex !== -1) this.moveTabTo(tab, ++tabNum); @@ -2081,7 +2083,7 @@ var aRelatedBrowser; var aOriginPrincipal; var aOpener; - var aSkipBackgroundNotify; + var aSkipBackgroundNotify; if (arguments.length == 2 && typeof arguments[1] == "object" && !(arguments[1] instanceof Ci.nsIURI)) { @@ -2127,11 +2129,11 @@ t.setAttribute("crop", "end"); t.setAttribute("onerror", "this.removeAttribute('image');"); - + if (aSkipBackgroundNotify) { t.setAttribute("skipbackgroundnotify", true); } - + t.className = "tabbrowser-tab"; this.tabContainer._unlockTabSizing(); -- cgit v1.2.3