Bug 1160076 - Hide the in-content preferences Search pane when browser.search.showOneOffButtons is false. r=Gijs, a=sledru
authorFlorian Quèze <florian@queze.net>
Tue, 05 May 2015 15:58:58 +0200
changeset 260459 855c88138927
parent 260458 ad9164105253
child 260460 5fc66f6dd277
push id786
push userryanvm@gmail.com
push date2015-05-11 14:41 +0000
treeherdermozilla-release@85229fbaf017 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, sledru
bugs1160076
milestone38.0.5
Bug 1160076 - Hide the in-content preferences Search pane when browser.search.showOneOffButtons is false. r=Gijs, a=sledru
browser/components/preferences/in-content/search.js
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -2,29 +2,31 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
 
 const ENGINE_FLAVOR = "text/x-moz-search-engine";
 
+document.addEventListener("Initialized", () => {
+  if (Services.prefs.getBoolPref("browser.search.showOneOffButtons"))
+    return;
+
+  document.getElementById("category-search").hidden = true;
+  if (document.location.hash == "#search")
+    document.location.hash = "";
+});
+
 var gEngineView = null;
 
 var gSearchPane = {
 
   init: function ()
   {
-    if (!Services.prefs.getBoolPref("browser.search.showOneOffButtons")) {
-      document.getElementById("category-search").hidden = true;
-      if (document.location.hash == "#search")
-        document.location.hash = "";
-      return;
-    }
-
     gEngineView = new EngineView(new EngineStore());
     document.getElementById("engineList").view = gEngineView;
     this.buildDefaultEngineDropDown();
 
     window.addEventListener("click", this, false);
     window.addEventListener("command", this, false);
     window.addEventListener("dragstart", this, false);
     window.addEventListener("keypress", this, false);