Bug 1503600 - Reorder "Manage Extension" and "Remove Extension" in browserAction context menu. r=Gijs, a=RyanVM
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Wed, 31 Oct 2018 16:55:06 +0000
changeset 500990 2059d2a6dc80e5f8699e947518b53542cec4df0c
parent 500989 39fba433d3258c1086a4575734740760feafb8e7
child 500991 256850965ce36f42ce0f6f66db5c26f5dd630591
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, RyanVM
bugs1503600
milestone64.0
Bug 1503600 - Reorder "Manage Extension" and "Remove Extension" in browserAction context menu. r=Gijs, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D10382
browser/base/content/browser.js
browser/base/content/browser.xul
browser/components/customizableui/content/panelUI.inc.xul
browser/components/extensions/test/browser/browser_ext_browserAction_contextMenu.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6398,18 +6398,18 @@ var ToolbarContextMenu = {
     if (triggerNode && gCustomizeMode.isWrappedToolbarItem(triggerNode)) {
       return triggerNode.firstElementChild;
     }
     return triggerNode;
   },
 
   updateExtension(popup) {
     let removeExtension = popup.querySelector(".customize-context-removeExtension");
-    let manageExtension = removeExtension.nextElementSibling;
-    let separator = manageExtension.nextElementSibling;
+    let manageExtension = popup.querySelector(".customize-context-manageExtension");
+    let separator = removeExtension.nextElementSibling;
     let node = this._getUnwrappedTriggerNode(popup);
     let isWebExt = node && node.hasAttribute("data-extensionid");
     removeExtension.hidden = manageExtension.hidden = separator.hidden = !isWebExt;
   },
 
   async removeExtensionForContextAction(popup) {
     let id = this._getUnwrappedTriggerNode(popup).getAttribute("data-extensionid");
     let addon = await AddonManager.getAddonByID(id);
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -413,26 +413,26 @@ xmlns="http://www.w3.org/1999/xhtml"
       <toolbarseparator/>
       <toolbarbutton label="&sidebarMenuClose.label;"
                      class="subviewbutton"
                      oncommand="SidebarUI.hide()"/>
     </panel>
 
     <menupopup id="toolbar-context-menu"
                onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator')); ToolbarContextMenu.updateDownloadsAutoHide(this); ToolbarContextMenu.updateExtension(this)">
+      <menuitem oncommand="ToolbarContextMenu.openAboutAddonsForContextAction(this.parentElement)"
+                accesskey="&customizeMenu.manageExtension.accesskey;"
+                label="&customizeMenu.manageExtension.label;"
+                contexttype="toolbaritem"
+                class="customize-context-manageExtension"/>
       <menuitem oncommand="ToolbarContextMenu.removeExtensionForContextAction(this.parentElement)"
                 accesskey="&customizeMenu.removeExtension.accesskey;"
                 label="&customizeMenu.removeExtension.label;"
                 contexttype="toolbaritem"
                 class="customize-context-removeExtension"/>
-      <menuitem oncommand="ToolbarContextMenu.openAboutAddonsForContextAction(this.parentElement)"
-                accesskey="&customizeMenu.manageExtension.accesskey;"
-                label="&customizeMenu.manageExtension.label;"
-                contexttype="toolbaritem"
-                class="customize-context-manageExtension"/>
       <menuseparator/>
       <menuitem oncommand="gCustomizeMode.addToPanel(document.popupNode)"
                 accesskey="&customizeMenu.pinToOverflowMenu.accesskey;"
                 label="&customizeMenu.pinToOverflowMenu.label;"
                 contexttype="toolbaritem"
                 class="customize-context-moveToPanel"/>
       <menuitem oncommand="ToolbarContextMenu.onDownloadsAutoHideChange(event)"
                 type="checkbox"
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -25,26 +25,26 @@
                       label="&overflowCustomizeToolbar.label;"/>
     </panelview>
   </panelmultiview>
   <!-- This menu is here because not having it in the menu in which it's used flickers
        when hover styles overlap. See https://bugzilla.mozilla.org/show_bug.cgi?id=1378427 .
        -->
   <menupopup id="customizationPanelItemContextMenu"
              onpopupshowing="gCustomizeMode.onPanelContextMenuShowing(event); ToolbarContextMenu.updateExtension(this)">
+    <menuitem oncommand="ToolbarContextMenu.openAboutAddonsForContextAction(this.parentElement)"
+              accesskey="&customizeMenu.manageExtension.accesskey;"
+              label="&customizeMenu.manageExtension.label;"
+              contexttype="toolbaritem"
+              class="customize-context-manageExtension"/>
     <menuitem oncommand="ToolbarContextMenu.removeExtensionForContextAction(this.parentElement)"
               accesskey="&customizeMenu.removeExtension.accesskey;"
               label="&customizeMenu.removeExtension.label;"
               contexttype="toolbaritem"
               class="customize-context-removeExtension"/>
-    <menuitem oncommand="ToolbarContextMenu.openAboutAddonsForContextAction(this.parentElement)"
-              accesskey="&customizeMenu.manageExtension.accesskey;"
-              label="&customizeMenu.manageExtension.label;"
-              contexttype="toolbaritem"
-              class="customize-context-manageExtension"/>
     <menuseparator/>
     <menuitem oncommand="gCustomizeMode.addToPanel(document.popupNode)"
               id="customizationPanelItemContextMenuPin"
               accesskey="&customizeMenu.pinToOverflowMenu.accesskey;"
               label="&customizeMenu.pinToOverflowMenu.label;"
               closemenu="single"
               class="customize-context-moveToPanel"/>
     <menuitem oncommand="gCustomizeMode.addToToolbar(document.popupNode)"
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_contextMenu.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_contextMenu.js
@@ -137,17 +137,17 @@ add_task(async function browseraction_co
       "options.html": `<script src="options.js"></script>`,
       "options.js": `browser.test.sendMessage("options-loaded");`,
     },
   });
 
   function checkVisibility(menu, visible) {
     let removeExtension = menu.querySelector(".customize-context-removeExtension");
     let manageExtension = menu.querySelector(".customize-context-manageExtension");
-    let separator = manageExtension.nextElementSibling;
+    let separator = removeExtension.nextElementSibling;
 
     info(`Check visibility`);
     let expected = visible ? "visible" : "hidden";
     is(removeExtension.hidden, !visible, `Remove Extension should be ${expected}`);
     is(manageExtension.hidden, !visible, `Manage Extension should be ${expected}`);
     is(separator.hidden, !visible, `Separator after Manage Extension should be ${expected}`);
   }