Bug 1559345 - Searchbar magnifying glass icon is missing in customize mode, r=mak

Differential Revision: https://phabricator.services.mozilla.com/D35021

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexander Surkov 2019-06-18 18:08:04 +00:00
Родитель 73b1eb5bc6
Коммит 52e204d997
1 изменённых файлов: 17 добавлений и 14 удалений

Просмотреть файл

@ -52,18 +52,25 @@ class MozSearchbar extends MozXULElement {
<image class="search-go-button urlbar-icon" hidden="true" onclick="handleSearchCommand(event);" tooltiptext="&contentSearchSubmit.tooltip;"></image> <image class="search-go-button urlbar-icon" hidden="true" onclick="handleSearchCommand(event);" tooltiptext="&contentSearchSubmit.tooltip;"></image>
</hbox> </hbox>
`, ["chrome://browser/locale/browser.dtd"]); `, ["chrome://browser/locale/browser.dtd"]);
this._ignoreFocus = false;
this._engines = null;
} }
connectedCallback() { connectedCallback() {
// Don't initialize if this isn't going to be visible // Don't initialize if this isn't going to be visible
if (this.closest("#BrowserToolbarPalette") || if (this.closest("#BrowserToolbarPalette")) {
this.parentNode.parentNode.localName == "toolbarpaletteitem") {
return; return;
} }
this.appendChild(document.importNode(this.content, true)); this.appendChild(document.importNode(this.content, true));
this.initializeAttributeInheritance(); this.initializeAttributeInheritance();
// Don't go further if in Customize mode.
if (this.parentNode.parentNode.localName == "toolbarpaletteitem") {
return;
}
this._stringBundle = this.querySelector("stringbundle"); this._stringBundle = this.querySelector("stringbundle");
this._textbox = this.querySelector(".searchbar-textbox"); this._textbox = this.querySelector(".searchbar-textbox");
@ -71,9 +78,6 @@ class MozSearchbar extends MozXULElement {
this._initTextbox(); this._initTextbox();
window.addEventListener("unload", this.destroy); window.addEventListener("unload", this.destroy);
this._ignoreFocus = false;
this._engines = null;
this.FormHistory = (ChromeUtils.import("resource://gre/modules/FormHistory.jsm", {})).FormHistory; this.FormHistory = (ChromeUtils.import("resource://gre/modules/FormHistory.jsm", {})).FormHistory;
@ -145,22 +149,21 @@ class MozSearchbar extends MozXULElement {
} }
destroy() { destroy() {
if (!this._initialized) { if (this._initialized) {
return; this._initialized = false;
window.removeEventListener("unload", this.destroy);
Services.obs.removeObserver(this.observer, "browser-search-engine-modified");
Services.obs.removeObserver(this.observer, "browser-search-service");
} }
this._initialized = false;
window.removeEventListener("unload", this.destroy);
Services.obs.removeObserver(this.observer, "browser-search-engine-modified");
Services.obs.removeObserver(this.observer, "browser-search-service");
// 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.
// Also make sure the textbox has ever been constructed, otherwise the // Also make sure the textbox has ever been constructed, otherwise the
// _textbox getter will cause the textbox constructor to run, add an // _textbox getter will cause the textbox constructor to run, add an
// observer, and leak the world too. // observer, and leak the world too.
if (this._textbox.mController && this._textbox.mController.input == this) { if (this._textbox && this._textbox.mController &&
this._textbox.mController.input == this) {
this._textbox.mController.input = null; this._textbox.mController.input = null;
} }
} }