Bug 1401238 - remove pocket entries in bookmarks menu button panel and bookmarks menu, r?jaws draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 20 Sep 2017 01:00:25 +0100
changeset 667350 c3e7729e8eea7032011e4f68b4b1b28afb0dfe96
parent 667349 011f90dfea74daf5f64a90fc617d9c15a75cced5
child 732354 5fdde0fad1bc7b78e51f08190f1cae92ed5f0b33
push id80679
push userbmo:gijskruitbosch+bugs@gmail.com
push dateWed, 20 Sep 2017 00:13:40 +0000
reviewersjaws
bugs1401238
milestone57.0a1
Bug 1401238 - remove pocket entries in bookmarks menu button panel and bookmarks menu, r?jaws MozReview-Commit-ID: HPxVus6oXjS
browser/extensions/pocket/bootstrap.js
browser/extensions/pocket/skin/shared/pocket.css
browser/extensions/pocket/test/browser_pocket_ui_check.js
--- a/browser/extensions/pocket/bootstrap.js
+++ b/browser/extensions/pocket/bootstrap.js
@@ -367,19 +367,18 @@ var PocketOverlay = {
     // we need to manually unregister here anyway to ensure these aren't part
     // of the chrome process and avoid errors.
     AboutPocket.aboutSaved.unregister();
     AboutPocket.aboutSignup.unregister();
 
     PocketPageAction.shutdown();
 
     for (let window of browserWindows()) {
-      for (let id of ["panelMenu_pocket", "menu_pocket", "BMB_pocket",
-                      "panelMenu_pocketSeparator", "menu_pocketSeparator",
-                      "BMB_pocketSeparator", "appMenu-library-pocket-button"]) {
+      for (let id of ["panelMenu_pocket", "panelMenu_pocketSeparator",
+                      "appMenu-library-pocket-button"]) {
         let element = window.document.getElementById(id) ||
                       window.gNavToolbox.palette.querySelector("#" + id);
         if (element)
           element.remove();
       }
       this.removeStyles(window);
       // remove script getters/objects
       delete window.Pocket;
@@ -408,57 +407,18 @@ var PocketOverlay = {
     Object.defineProperty(window, "pktUIMessaging", pktUIGetter("pktUIMessaging", window));
   },
   // called for each window as it is opened
   updateWindow(window) {
     // insert our three menu items
     let document = window.document;
     let hidden = !isPocketEnabled();
 
-    // add to bookmarksMenu
-    let sib = document.getElementById("menu_bookmarkThisPage");
-    if (sib && !document.getElementById("menu_pocket")) {
-      let menu = createElementWithAttrs(document, "menuitem", {
-        "id": "menu_pocket",
-        "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
-        "class": "menuitem-iconic", // OSX only
-        "oncommand": "Pocket.openList(event)",
-        "hidden": hidden
-      });
-      let sep = createElementWithAttrs(document, "menuseparator", {
-        "id": "menu_pocketSeparator",
-        "hidden": hidden
-      });
-      sib.parentNode.insertBefore(menu, sib);
-      sib.parentNode.insertBefore(sep, sib);
-    }
-
-    // add to bookmarks-menu-button
-    sib = document.getElementById("BMB_bookmarksToolbar");
-    if (!sib) {
-      sib = window.gNavToolbox.palette.querySelector("#BMB_bookmarksToolbar");
-    }
-    if (sib && !sib.parentNode.querySelector("#BMB_pocket")) {
-      let menu = createElementWithAttrs(document, "menuitem", {
-        "id": "BMB_pocket",
-        "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
-        "class": "menuitem-iconic bookmark-item subviewbutton",
-        "oncommand": "Pocket.openList(event)",
-        "hidden": hidden
-      });
-      let sep = createElementWithAttrs(document, "menuseparator", {
-        "id": "BMB_pocketSeparator",
-        "hidden": hidden
-      });
-      sib.parentNode.insertBefore(menu, sib);
-      sib.parentNode.insertBefore(sep, sib);
-    }
-
     // add to PanelUI-bookmarks
-    sib = document.getElementById("panelMenuBookmarkThisPage");
+    let sib = document.getElementById("panelMenuBookmarkThisPage");
     if (sib && !document.getElementById("panelMenu_pocket")) {
       let menu = createElementWithAttrs(document, "toolbarbutton", {
         "id": "panelMenu_pocket",
         "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
         "class": "subviewbutton cui-withicon",
         "oncommand": "Pocket.openList(event)",
         "hidden": hidden
       });
--- a/browser/extensions/pocket/skin/shared/pocket.css
+++ b/browser/extensions/pocket/skin/shared/pocket.css
@@ -202,26 +202,22 @@
     -moz-image-region: rect(64px, 64px, 128px, 0);
   }
 }
 
 #appMenu-library-pocket-button {
   list-style-image: url("chrome://pocket-shared/skin/pocket.svg");
 }
 
-#panelMenu_pocket,
-#menu_pocket,
-#BMB_pocket {
+#panelMenu_pocket {
   list-style-image: url("chrome://pocket/content/panels/img/pocketmenuitem16.png");
 }
 
 @media (min-resolution: 2dppx) {
-  #panelMenu_pocket,
-  #menu_pocket,
-  #BMB_pocket {
+  #panelMenu_pocket {
     list-style-image: url("chrome://pocket/content/panels/img/pocketmenuitem16@2x.png");
   }
 
   #panelMenu_pocket > .toolbarbutton-icon {
     width: 16px;
   }
 }
 
--- a/browser/extensions/pocket/test/browser_pocket_ui_check.js
+++ b/browser/extensions/pocket/test/browser_pocket_ui_check.js
@@ -23,19 +23,18 @@ add_task(async function test_setup() {
     }
   });
 });
 
 add_task(async function() {
   await promisePocketEnabled();
 
   checkWindowProperties(true, ["Pocket", "pktUI", "pktUIMessaging"]);
-  checkElements(true, ["pocket-button", "panelMenu_pocket", "menu_pocket", "BMB_pocket",
-                       "panelMenu_pocketSeparator", "menu_pocketSeparator",
-                       "BMB_pocketSeparator"]);
+  checkElements(true, ["pocket-button", "panelMenu_pocket",
+                       "panelMenu_pocketSeparator"]);
 
   // check context menu exists
   info("checking content context menu");
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "https://example.com/browser/browser/extensions/pocket/test/test.html");
 
   let contextMenu = document.getElementById("contentAreaContextMenu");
   let popupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
   let popupHidden = BrowserTestUtils.waitForEvent(contextMenu, "popuphidden");
@@ -49,14 +48,13 @@ add_task(async function() {
 
   contextMenu.hidePopup();
   await popupHidden;
   await BrowserTestUtils.removeTab(tab);
 
   await promisePocketDisabled();
 
   checkWindowProperties(false, ["Pocket", "pktUI", "pktUIMessaging"]);
-  checkElements(false, ["pocket-button", "panelMenu_pocket", "menu_pocket", "BMB_pocket",
-                       "panelMenu_pocketSeparator", "menu_pocketSeparator",
-                       "BMB_pocketSeparator", "context-pocket", "context-savelinktopocket"]);
+  checkElements(false, ["pocket-button", "panelMenu_pocket", "panelMenu_pocketSeparator",
+                        "context-pocket", "context-savelinktopocket"]);
 
   await promisePocketReset();
 });