Bug 1371144 - Add the library button as a UITour target. r=mattN draft
authorgasolin <gasolin@gmail.com>
Fri, 09 Jun 2017 16:35:21 +0800
changeset 592301 c87f3850ab52447e23074731448d26b8cf22ccb1
parent 592285 981da978f1f686ad024fa958c9d27d2f8acc5ad0
child 632768 161f5fd9f25d222c3b00cd0a3cbdabfeaa76f6ed
push id63332
push userbmo:gasolin@mozilla.com
push dateMon, 12 Jun 2017 01:28:13 +0000
reviewersmattN
bugs1371144
milestone55.0a1
Bug 1371144 - Add the library button as a UITour target. r=mattN MozReview-Commit-ID: BSGMbdlujrC
browser/components/uitour/UITour-lib.js
browser/components/uitour/UITour.jsm
browser/components/uitour/test/browser_UITour_availableTargets.js
--- a/browser/components/uitour/UITour-lib.js
+++ b/browser/components/uitour/UITour-lib.js
@@ -102,19 +102,20 @@ if (typeof Mozilla == "undefined") {
    * <li>addons
    * <li>appMenu
    * <li>backForward
    * <li>bookmarks
    * <li>controlCenter-trackingUnblock
    * <li>controlCenter-trackingBlock
    * <li>customize
    * <li>devtools
+   * <li>forget
    * <li>help
    * <li>home
-   * <li>forget
+   * <li>library
    * <li>pocket
    * <li>privateWindow
    * <li>quit
    * <li>readerMode-urlBar
    * <li>search
    * <li>searchIcon
    * <li>searchPrefsLink
    * <li>selectedTabIcon
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -162,27 +162,34 @@ this.UITour = {
           return button;
         }
         return aDocument.getElementById("appMenu-developer-button");
       },
       get widgetName() {
         return gPhotonStructure ? "appMenu-developer-button" : "developer-button";
       },
     }],
+    ["forget", {
+      allowAdd: true,
+      query: "#panic-button",
+      widgetName: "panic-button",
+    }],
     ["help", {
       query: (aDocument) => {
         let buttonId = gPhotonStructure ? "appMenu-help-button" : "PanelUI-help";
         return aDocument.getElementById(buttonId);
       }
     }],
     ["home",        {query: "#home-button"}],
-    ["forget", {
-      allowAdd: true,
-      query: "#panic-button",
-      widgetName: "panic-button",
+    ["library", {
+     query: (aDocument) => {
+        let buttonId = "appMenu-library-button";
+        return gPhotonStructure ?
+          aDocument.getElementById(buttonId) : null;
+      }
     }],
     ["pocket", {
       allowAdd: true,
       query: "#pocket-button",
       widgetName: "pocket-button",
     }],
     ["privateWindow", {
       query(aDocument) {
--- a/browser/components/uitour/test/browser_UITour_availableTargets.js
+++ b/browser/components/uitour/test/browser_UITour_availableTargets.js
@@ -1,33 +1,36 @@
 "use strict";
 
 var gTestTab;
 var gContentAPI;
 var gContentWindow;
 
 var hasPocket = Services.prefs.getBoolPref("extensions.pocket.enabled");
-var hasQuit = !Services.prefs.getBoolPref("browser.photon.structure.enabled") ||
+var isPhoton = Services.prefs.getBoolPref("browser.photon.structure.enabled");
+var hasQuit = !isPhoton ||
               false; // Update this with AppConstants.platform != "macosx" after bug 1368734 lands;
+var hasLibrary = isPhoton || false;
 
 requestLongerTimeout(2);
 add_task(setup_UITourTest);
 
 add_UITour_task(async function test_availableTargets() {
   let data = await getConfigurationPromise("availableTargets");
   ok_targets(data, [
     "accountStatus",
     "addons",
     "appMenu",
     "backForward",
     "bookmarks",
     "customize",
+    "devtools",
     "help",
     "home",
-    "devtools",
+      ...(hasLibrary ? ["library"] : []),
       ...(hasPocket ? ["pocket"] : []),
     "privateWindow",
       ...(hasQuit ? ["quit"] : []),
     "readerMode-urlBar",
     "search",
     "searchIcon",
     "trackingProtection",
     "urlbar",
@@ -46,16 +49,17 @@ add_UITour_task(async function test_avai
     "accountStatus",
     "addons",
     "appMenu",
     "backForward",
     "customize",
     "help",
     "devtools",
     "home",
+      ...(hasLibrary ? ["library"] : []),
       ...(hasPocket ? ["pocket"] : []),
     "privateWindow",
       ...(hasQuit ? ["quit"] : []),
     "readerMode-urlBar",
     "search",
     "searchIcon",
     "trackingProtection",
     "urlbar",
@@ -76,19 +80,20 @@ add_UITour_task(async function test_avai
   // Default minus "search" and "searchIcon"
   ok_targets(data, [
     "accountStatus",
     "addons",
     "appMenu",
     "backForward",
     "bookmarks",
     "customize",
+    "devtools",
     "help",
     "home",
-    "devtools",
+      ...(hasLibrary ? ["library"] : []),
       ...(hasPocket ? ["pocket"] : []),
     "privateWindow",
       ...(hasQuit ? ["quit"] : []),
     "readerMode-urlBar",
     "trackingProtection",
     "urlbar",
   ]);