Bug 1103163: Don't show a link to a missing preferences panel when the one-off UI isn't active. r=felipe, a=gavin
authorDave Townsend <dtownsend@oxymoronical.com>
Fri, 21 Nov 2014 13:59:30 -0800
changeset 226122 1e2510a0b8a04cf6fd8f0aa76cc7281344612512
parent 226121 86ac124fa5fc0992e74c04c22c52f675a7ae922f
child 226123 84717f538f7b55f05ee83b1dcccd3273a78bee2d
push id4168
push userdtownsend@mozilla.com
push dateFri, 21 Nov 2014 22:04:19 +0000
treeherdermozilla-beta@84717f538f7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe, gavin
bugs1103163
milestone34.0
Bug 1103163: Don't show a link to a missing preferences panel when the one-off UI isn't active. r=felipe, a=gavin
browser/base/content/newtab/search.js
browser/modules/AboutHome.jsm
--- a/browser/base/content/newtab/search.js
+++ b/browser/base/content/newtab/search.js
@@ -14,16 +14,20 @@ let gSearch = {
         document.getElementById("newtab-search-" + idSuffix);
     }
 
     window.addEventListener("ContentSearchService", this);
     this._send("GetState");
   },
 
   showPanel: function () {
+    if (!Services.prefs.getBoolPref("browser.search.showOneOffButtons")) {
+      return;
+    }
+
     let panel = this._nodes.panel;
     let icon = this._nodes.icon;
     panel.openPopup(icon);
     icon.setAttribute("active", "true");
     panel.addEventListener("popuphidden", function onHidden() {
       panel.removeEventListener("popuphidden", onHidden);
       icon.removeAttribute("active");
     });
--- a/browser/modules/AboutHome.jsm
+++ b/browser/modules/AboutHome.jsm
@@ -201,16 +201,20 @@ let AboutHome = {
           // Used for testing
           let mm = aMessage.target.messageManager;
           mm.sendAsyncMessage("AboutHome:SearchTriggered", aMessage.data.searchData);
         });
 
         break;
 
       case "AboutHome:OpenSearchPanel":
+        if (!Services.prefs.getBoolPref("browser.search.showOneOffButtons")) {
+          return;
+        }
+
         let panel = window.document.getElementById("abouthome-search-panel");
         let anchor = aMessage.objects.anchor;
         panel.openPopup(anchor);
         anchor.setAttribute("active", "true");
         panel.addEventListener("popuphidden", function onHidden() {
           panel.removeEventListener("popuphidden", onHidden);
           anchor.removeAttribute("active");
         });