Bug 1615239 - Define FormHistory in the search textbox and don't assume that a search bar exists. r=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Thu, 13 Feb 2020 15:01:25 +0100
changeset 37481 915e5658d0b9f7ebc19505542ea15c90bbf3c065
parent 37480 0d93f5cf6d4956ef6e65ff0aa1ca9db5a7bf685b
child 37482 98fe11c81b149b29acf1fb441b7dfc769e3be065
push id2566
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:20:31 +0000
treeherdercomm-beta@a352facfa0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN
bugs1615239
Bug 1615239 - Define FormHistory in the search textbox and don't assume that a search bar exists. r=IanN
suite/components/search/content/search.xml
--- a/suite/components/search/content/search.xml
+++ b/suite/components/search/content/search.xml
@@ -522,17 +522,21 @@
             "toolbarpaletteitem")
           return;
 
         if (Services.prefs.getBoolPref("browser.urlbar.clickSelectsAll"))
           this.setAttribute("clickSelectsAll", true);
 
         // Add items to context menu and attach controller to handle them
         this.controllers.appendController(this.searchbarController);
-        document.getBindingParent(this)._textboxInitialized = true;
+        // bindingParent is not set in the sidebar because there is no
+        // searchbar created in it.
+        if (bindingParent) {
+          bindingParent._textboxInitialized = true;
+        }
 
         // Add observer for suggest preference
         Services.prefs.addObserver("browser.search.suggest.enabled", this);
 
         this._inputBox.setAttribute("suggestchecked", this._suggestEnabled);
       ]]></constructor>
 
       <destructor><![CDATA[
@@ -559,16 +563,22 @@
           if (aTopic == "nsPref:changed") {
             this._suggestEnabled =
               Services.prefs.getBoolPref("browser.search.suggest.enabled");
             this._inputBox.setAttribute("suggestchecked", this._suggestEnabled);
           }
         ]]></body>
       </method>
 
+      <field name="FormHistory" readonly="true"><![CDATA[
+        (ChromeUtils.import("resource://gre/modules/FormHistory.jsm", {}))
+                    .FormHistory;
+        ]]>
+      </field>
+
       <!-- nsIController -->
       <field name="searchbarController" readonly="true"><![CDATA[({
         supportsCommand: function(aCommand) {
           switch (aCommand) {
             case "cmd_pasteAndSearch":
             case "cmd_clearhistory":
             case "cmd_togglesuggest":
               return true;