Bug 1383749 - One-off buttons should be cached the first time, r=mak.
authorFlorian Quèze <florian@queze.net>
Mon, 24 Jul 2017 22:54:48 +0200
changeset 419472 91a2c24475fa8161f9dc98088dfda9a96e69bf96
parent 419471 a75faf9cd6a7bf61bb3fc5b9202932de01a61e0b
child 419473 7a7db98b3785ace1e19637b6595a79864251bc7d
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1383749
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383749 - One-off buttons should be cached the first time, r=mak.
browser/base/content/urlbarBindings.xml
browser/components/search/content/search.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1680,23 +1680,25 @@ file, You can obtain one at http://mozil
 
       <method name="enableOneOffSearches">
         <parameter name="enable"/>
         <body><![CDATA[
           this._oneOffSearchesEnabled = enable;
           if (enable) {
             this.oneOffSearchButtons.telemetryOrigin = "urlbar";
             this.oneOffSearchButtons.style.display = "-moz-box";
+            // Set .textbox first, since the popup setter will cause
+            // a _rebuild call that uses it.
+            this.oneOffSearchButtons.textbox = this.input;
             this.oneOffSearchButtons.popup = this;
-            this.oneOffSearchButtons.textbox = this.input;
           } else {
             this.oneOffSearchButtons.telemetryOrigin = null;
             this.oneOffSearchButtons.style.display = "none";
+            this.oneOffSearchButtons.textbox = null;
             this.oneOffSearchButtons.popup = null;
-            this.oneOffSearchButtons.textbox = null;
           }
         ]]></body>
       </method>
 
       <method name="openSearchSuggestionsNotificationLearnMoreURL">
         <body><![CDATA[
         let url = Services.urlFormatter.formatURL(
           Services.prefs.getCharPref("app.support.baseURL") + "suggestions"
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -97,18 +97,20 @@
         // Wait until the popupshowing event to avoid forcing immediate
         // attachment of the search-one-offs binding.
         this.textbox.popup.addEventListener("popupshowing", () => {
           let oneOffButtons = this.textbox.popup.oneOffButtons;
           // Some accessibility tests create their own <searchbar> that doesn't
           // use the popup binding below, so null-check oneOffButtons.
           if (oneOffButtons) {
             oneOffButtons.telemetryOrigin = "searchbar";
+            // Set .textbox first, since the popup setter will cause
+            // a _rebuild call that uses it.
+            oneOffButtons.textbox = this.textbox;
             oneOffButtons.popup = this.textbox.popup;
-            oneOffButtons.textbox = this.textbox;
           }
         }, {capturing: true, once: true});
       ]]></constructor>
 
       <destructor><![CDATA[
         this.destroy();
       ]]></destructor>