Bug 1371144 - Add the library button as a UITour target. r=MattN
authorgasolin <gasolin@gmail.com>
Fri, 09 Jun 2017 16:35:21 +0800
changeset 413890 ab78c7663a97b34babc1b3169e2110f7796a5fb5
parent 413889 f6a8aef8986c3faaa506d44de4b22f42fd1f5c3a
child 413891 2629ca0641a72087efcc1d12498519450070dbc7
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1371144
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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",
   ]);