Bug 1245074 workaround CUI defaults for pocket to fix restore defaults, r=gijs a=lizzard CLOSED TREE
authorShane Caraveo <scaraveo@mozilla.com>
Tue, 22 Mar 2016 12:43:38 -0700
changeset 323589 4b14e550e7d8dc76f51b929a296d6391a884585f
parent 323588 93c743ac43d7795db51638c7e992fd85b3b8f1ac
child 323590 e6bd5cd06759d78f752c215c9ea6adab4c25a995
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs, lizzard
bugs1245074
milestone47.0a2
Bug 1245074 workaround CUI defaults for pocket to fix restore defaults, r=gijs a=lizzard CLOSED TREE MozReview-Commit-ID: Ahff5EWIjV4
browser/app/profile/firefox.js
browser/components/customizableui/CustomizableUI.jsm
browser/extensions/pocket/bootstrap.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1656,8 +1656,10 @@ pref("media.webspeech.synth.enabled", tr
 #endif
 
 pref("browser.esedbreader.loglevel", "Error");
 
 pref("browser.laterrun.enabled", false);
 
 // Enable browser frames for use on desktop.  Only exposed to chrome callers.
 pref("dom.mozBrowserFramesEnabled", true);
+
+pref("extensions.pocket.enabled", true);
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -244,16 +244,23 @@ var CustomizableUIInternal = {
     if (AppConstants.MOZ_DEV_EDITION) {
       navbarPlacements.splice(2, 0, "developer-button");
     }
 
     if (Services.prefs.getBoolPref(kPrefWebIDEInNavbar)) {
       navbarPlacements.push("webide-button");
     }
 
+    // Place this last, when createWidget is called for pocket, it will
+    // append to the toolbar.
+    if (Services.prefs.getPrefType("extensions.pocket.enabled") != Services.prefs.PREF_INVALID &&
+        Services.prefs.getBoolPref("extensions.pocket.enabled")) {
+        navbarPlacements.push("pocket-button");
+    }
+
     this.registerArea(CustomizableUI.AREA_NAVBAR, {
       legacy: true,
       type: CustomizableUI.TYPE_TOOLBAR,
       overflowable: true,
       defaultPlacements: navbarPlacements,
       defaultCollapsed: false,
     }, true);
 
--- a/browser/extensions/pocket/bootstrap.js
+++ b/browser/extensions/pocket/bootstrap.js
@@ -217,17 +217,17 @@ var PocketContextMenu = {
     Services.obs.addObserver(this, "on-build-contextmenu", false);
   },
   shutdown: function() {
     Services.obs.removeObserver(this, "on-build-contextmenu");
     // loop through windows and remove context menus
     // iterate through all windows and add pocket to them
     for (let win of allBrowserWindows()) {
       let document = win.document;
-      for (let id in ["context-pocket", "context-savelinktopocket"]) {
+      for (let id of ["context-pocket", "context-savelinktopocket"]) {
         let element = document.getElementById(id);
         if (element)
           element.remove();
       }
     }
   },
   observe: function(aSubject, aTopic, aData) {
     let subject = aSubject.wrappedJSObject;