Bug 1353831 - OneOff block in search bar doesn't update text if Customize was opened at least once. r=florian

MozReview-Commit-ID: Iu7xhCbCh6B

--HG--
extra : rebase_source : c3c68c7935393c7e8ad264010ce4bd6b53d6a6f5
This commit is contained in:
Drew Willcoxon 2017-04-14 16:34:41 -07:00
Родитель 4f0389f555
Коммит c62a09b53e
1 изменённых файлов: 10 добавлений и 9 удалений

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

@ -72,8 +72,6 @@
<constructor><![CDATA[
if (this.parentNode.parentNode.localName == "toolbarpaletteitem")
return;
// Make sure we rebuild the popup in onpopupshowing
this._needToBuildPopup = true;
Services.obs.addObserver(this, "browser-search-engine-modified", false);
@ -92,6 +90,14 @@
Components.utils.reportError("Cannot initialize search service, bailing out: " + aStatus);
}
}).bind(this));
// Some accessibility tests create their own <searchbar> that doesn't
// use the popup binding below, so null-check oneOffButtons.
if (this.textbox.popup.oneOffButtons) {
this.textbox.popup.oneOffButtons.telemetryOrigin = "searchbar";
this.textbox.popup.oneOffButtons.popup = this.textbox.popup;
this.textbox.popup.oneOffButtons.textbox = this.textbox;
}
]]></constructor>
<destructor><![CDATA[
@ -1072,7 +1078,7 @@
<handlers>
<handler event="popupshowing"><![CDATA[
if (!this.oneOffButtons.popup) {
if (!this._computedMinWidth) {
// The panel width only spans to the textbox size, but we also want it
// to include the magnifier icon's width.
let ltr = getComputedStyle(this).direction == "ltr";
@ -1086,12 +1092,7 @@
);
this.style.minWidth = minWidth + "px";
// Set the origin before assigning the popup, as the assignment does
// a rebuild and would miss the origin.
this.oneOffButtons.telemetryOrigin = "searchbar";
// Set popup after setting the minWidth since it builds the buttons.
this.oneOffButtons.popup = this;
this.oneOffButtons.textbox = this.input;
this._computedMinWidth = true;
}
// First handle deciding if we are showing the reduced version of the