Bug 1160663 - Allow hilighting the Pocket button via UITour. r=MattN a=sledru
authorJustin Dolske <dolske@mozilla.com>
Wed, 06 May 2015 16:53:48 -0700
changeset 260437 1701e22c91f6
parent 260436 52bc3790d7b0
child 260438 6be4fccbdfa3
push id782
push userjdolske@mozilla.com
push date2015-05-09 00:18 +0000
treeherdermozilla-release@067c9c7a5e75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, sledru
bugs1160663
milestone38.0
Bug 1160663 - Allow hilighting the Pocket button via UITour. r=MattN a=sledru
browser/components/uitour/UITour.jsm
browser/components/uitour/test/browser_UITour_availableTargets.js
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -183,16 +183,17 @@ this.UITour = {
       query: (aDocument) => {
         let loopBrowser = aDocument.defaultView.LoopUI.browser;
         if (!loopBrowser) {
           return null;
         }
         return loopBrowser.contentDocument.querySelector(".signin-link");
       },
     }],
+    ["pocket", {query: "#pocket-button"}],
     ["privateWindow",  {query: "#privatebrowsing-button"}],
     ["quit",        {query: "#PanelUI-quit"}],
     ["readerMode-urlBar", {query: "#reader-mode-button"}],
     ["search",      {
       infoPanelOffsetX: 18,
       infoPanelPosition: "after_start",
       query: "#searchbar",
       widgetName: "search-container",
--- a/browser/components/uitour/test/browser_UITour_availableTargets.js
+++ b/browser/components/uitour/test/browser_UITour_availableTargets.js
@@ -6,16 +6,36 @@
 let gTestTab;
 let gContentAPI;
 let gContentWindow;
 
 Components.utils.import("resource:///modules/UITour.jsm");
 
 let hasWebIDE = Services.prefs.getBoolPref("devtools.webide.widget.enabled");
 
+let hasPocket = false;
+if (Services.prefs.getBoolPref("browser.pocket.enabled")) {
+  let isEnabledForLocale = true;
+  if (Services.prefs.getBoolPref("browser.pocket.useLocaleList")) {
+    let chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
+                           .getService(Ci.nsIXULChromeRegistry);
+    let browserLocale = chromeRegistry.getSelectedLocale("browser");
+    let enabledLocales = [];
+    try {
+      enabledLocales = Services.prefs.getCharPref("browser.pocket.enabledLocales").split(' ');
+    } catch (ex) {
+      Cu.reportError(ex);
+    }
+    isEnabledForLocale = enabledLocales.indexOf(browserLocale) != -1;
+  }
+  if (isEnabledForLocale) {
+    hasPocket = true;
+  }
+}
+
 function test() {
   requestLongerTimeout(2);
   UITourTest();
 }
 
 function searchEngineTargets() {
   let engines = Services.search.getVisibleEngines();
   return ["searchEngine-" + engine.identifier
@@ -32,16 +52,17 @@ let tests = [
         "appMenu",
         "backForward",
         "bookmarks",
         "customize",
         "help",
         "home",
         "loop",
         "devtools",
+        ...(hasPocket ? ["pocket"] : []),
         "privateWindow",
         "quit",
         "readerMode-urlBar",
         "search",
         "searchIcon",
         "urlbar",
         ...searchEngineTargets(),
         ...(hasWebIDE ? ["webide"] : [])
@@ -63,16 +84,17 @@ let tests = [
         "addons",
         "appMenu",
         "backForward",
         "customize",
         "help",
         "loop",
         "devtools",
         "home",
+        ...(hasPocket ? ["pocket"] : []),
         "privateWindow",
         "quit",
         "readerMode-urlBar",
         "search",
         "searchIcon",
         "urlbar",
         ...searchEngineTargets(),
         ...(hasWebIDE ? ["webide"] : [])
@@ -99,16 +121,17 @@ let tests = [
         "appMenu",
         "backForward",
         "bookmarks",
         "customize",
         "help",
         "home",
         "loop",
         "devtools",
+        ...(hasPocket ? ["pocket"] : []),
         "privateWindow",
         "quit",
         "readerMode-urlBar",
         "urlbar",
         ...(hasWebIDE ? ["webide"] : [])
       ]);
 
       CustomizableUI.reset();