Bug 1106432 - Search bar icon should indicate when a page offers open search - fix leak caused by XBL in toolbarless popups, r=Gijs.

This commit is contained in:
Florian Quèze 2014-12-21 01:10:46 +01:00
parent 5c65e92619
commit 3af2f817fa

View File

@ -121,13 +121,17 @@
// Make sure to break the cycle from _textbox to us. Otherwise we leak // Make sure to break the cycle from _textbox to us. Otherwise we leak
// the world. But make sure it's actually pointing to us. // the world. But make sure it's actually pointing to us.
if (this._textbox.mController.input == this) // Also make sure the textbox has ever been constructed, otherwise the
// _textbox getter will cause the textbox constructor to run, add an
// observer, and leak the world too.
if (this._textboxInitialized && this._textbox.mController.input == this)
this._textbox.mController.input = null; this._textbox.mController.input = null;
]]></body> ]]></body>
</method> </method>
<field name="_stringBundle">document.getAnonymousElementByAttribute(this, <field name="_stringBundle">document.getAnonymousElementByAttribute(this,
"anonid", "searchbar-stringbundle");</field> "anonid", "searchbar-stringbundle");</field>
<field name="_textboxInitialized">false</field>
<field name="_textbox">document.getAnonymousElementByAttribute(this, <field name="_textbox">document.getAnonymousElementByAttribute(this,
"anonid", "searchbar-textbox");</field> "anonid", "searchbar-textbox");</field>
<field name="_popup">document.getAnonymousElementByAttribute(this, <field name="_popup">document.getAnonymousElementByAttribute(this,
@ -780,6 +784,7 @@
cxmenu.appendChild(element); cxmenu.appendChild(element);
this.controllers.appendController(this.searchbarController); this.controllers.appendController(this.searchbarController);
BrowserSearch.searchBar._textboxInitialized = true;
// Add observer for suggest preference // Add observer for suggest preference
var prefs = Components.classes["@mozilla.org/preferences-service;1"] var prefs = Components.classes["@mozilla.org/preferences-service;1"]