Bug 1357458 - After Customization - typed text in the Awesome bar doesn't correspond with the text from One-Off-Searches bar. r?florian draft
authorDrew Willcoxon <adw@mozilla.com>
Thu, 20 Apr 2017 19:00:26 -0700
changeset 566164 8ce26ee8defb4a38b1083ef9ba80ed9bb3b8ef05
parent 565512 4c09d2ddc229323ac7287649a6455d762d24f235
child 625217 6fa3304d6c113b6a0f39baacfaf051aca60cb896
push id55111
push userdwillcoxon@mozilla.com
push dateFri, 21 Apr 2017 02:01:52 +0000
reviewersflorian
bugs1357458
milestone55.0a1
Bug 1357458 - After Customization - typed text in the Awesome bar doesn't correspond with the text from One-Off-Searches bar. r?florian MozReview-Commit-ID: KHAoxS1CsWj
browser/base/content/urlbarBindings.xml
browser/components/search/content/search.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -119,16 +119,22 @@ file, You can obtain one at http://mozil
         this._prefs = null;
         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);
         this.inputField.removeEventListener("overflow", this);
         this.inputField.removeEventListener("underflow", this);
+
+        // Null out the one-offs' popup and textbox so that it cleans up its
+        // internal state for both.  Most importantly, it removes the event
+        // listeners that it added to both.
+        this.popup.oneOffSearchButtons.popup = null;
+        this.popup.oneOffSearchButtons.textbox = null;
       ]]></destructor>
 
       <field name="_value">""</field>
       <field name="gotResultForCurrentQuery">false</field>
 
       <!--
         This is set around HandleHenter so it can be used in handleCommand.
         It is also used to track whether we must handle a delayed handleEnter,
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -1231,20 +1231,16 @@
       <!-- The popup that contains the one-offs.  This is required, so it should
            never be null or undefined, except possibly before the one-offs are
            used. -->
       <property name="popup">
         <getter><![CDATA[
           return this._popup;
         ]]></getter>
         <setter><![CDATA[
-          if (this._popup == val) {
-            return val;
-          }
-
           let events = [
             "popupshowing",
             "popuphidden",
           ];
           if (this._popup) {
             for (let event of events) {
               this._popup.removeEventListener(event, this);
             }
@@ -1272,19 +1268,16 @@
            automatically keep the related one-offs UI up to date.  Otherwise you
            can leave it null/undefined, and in that case you should update the
            query property manually. -->
       <property name="textbox">
         <getter><![CDATA[
           return this._textbox;
         ]]></getter>
         <setter><![CDATA[
-          if (this._textbox == val) {
-            return val;
-          }
           if (this._textbox) {
             this._textbox.removeEventListener("input", this);
           }
           if (val) {
             val.addEventListener("input", this);
           }
           return this._textbox = val;
         ]]></setter>