Bug 1444614 - Avoid initializing gBrowser and gBrowser.tabContainer early in the urlbar binding constructor. r?gijs
MozReview-Commit-ID: Lfv4d8RzhmZ
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1577,16 +1577,18 @@ var gBrowserInit = {
// Enable the Restore Last Session command if needed
RestoreLastSessionObserver.init();
SidebarUI.startDelayedLoad();
PanicButtonNotifier.init();
});
+ gBrowser.tabContainer.addEventListener("TabSelect", gURLBar);
+
gBrowser.tabContainer.addEventListener("TabSelect", function() {
for (let panel of document.querySelectorAll("panel[tabspecific='true']")) {
if (panel.state == "open") {
panel.hidePopup();
}
}
});
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -128,21 +128,16 @@ file, You can obtain one at http://mozil
this.popup.addEventListener("popupshowing", () => {
this.setAttribute("open", "true");
});
this.popup.addEventListener("popuphidden", () => {
requestAnimationFrame(() => {
this.removeAttribute("open");
});
});
-
- // The autocomplete controller uses heuristic on some internal caches
- // to handle cases like backspace, autofill or repeated searches.
- // Ensure to clear those internal caches when switching tabs.
- gBrowser.tabContainer.addEventListener("TabSelect", this);
]]></constructor>
<destructor><![CDATA[
// Somehow, it's possible for the XBL destructor to fire without the
// constructor ever having fired. Fix:
if (!this._prefs) {
return;
}
@@ -1340,16 +1335,19 @@ file, You can obtain one at http://mozil
}
this.setAttribute("textoverflow", "true");
break;
case "underflow":
this.removeAttribute("textoverflow");
this._hideURLTooltip();
break;
case "TabSelect":
+ // The autocomplete controller uses heuristic on some internal caches
+ // to handle cases like backspace, autofill or repeated searches.
+ // Ensure to clear those internal caches when switching tabs.
this.controller.resetInternalState();
break;
}
]]></body>
</method>
<!--
onBeforeTextValueSet is called by the base-binding's .textValue getter.