Bug 1434045 - avoid errors when XBL destructors fire without the constructor having fired, r?florian
MozReview-Commit-ID: B9rWp4TEoqX
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -136,16 +136,21 @@ file, You can obtain one at http://mozil
// 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;
+ }
this._prefs.removeObserver("", this);
this._prefs = null;
Services.prefs.removeObserver("browser.search.suggest.enabled", this);
this.inputField.controllers.removeController(this._copyCutController);
this.inputField.removeEventListener("paste", this);
this.inputField.removeEventListener("mousedown", this);
this.inputField.removeEventListener("mousemove", this);
this.inputField.removeEventListener("mouseout", this);