Bug 1480532 - Remove 'Reload All Tabs' from tab context menu. r=Felipe
authorJared Wein <jwein@mozilla.com>
Fri, 12 Oct 2018 21:16:44 +0000
changeset 496680 99483ca5d3c61c9cfcc6d36f243769a454ab74e1
parent 496679 ab824c7f0dd9c50b042d620fbe751432e00dec68
child 496681 c8e0e2a2d30976c4843ff8955374cc5e32b815fc
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe
bugs1480532
milestone64.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 1480532 - Remove 'Reload All Tabs' from tab context menu. r=Felipe I left off the part about adding Reload Tabs to the All Tabs menu since the specs don't mention how this would appear with the New Container Tab menuitem and the Tab Manager project has been split off from the multiselect tabs project. Differential Revision: https://phabricator.services.mozilla.com/D8274
browser/base/content/browser.js
browser/base/content/browser.xul
browser/base/content/tabbrowser.js
browser/base/content/test/permissions/browser_temporary_permissions_navigation.js
browser/base/content/test/tabs/browser_visibleTabs_contextMenu.js
browser/components/customizableui/test/browser_customization_context_menus.js
browser/locales/en-US/chrome/browser/browser.dtd
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5765,20 +5765,21 @@ function onViewToolbarsPopupShowing(aEve
     node.hidden = showTabStripItems;
   }
 
   for (let node of popup.querySelectorAll('menuitem[contexttype="tabbar"]')) {
     node.hidden = !showTabStripItems;
   }
 
   if (showTabStripItems) {
-    let haveMultipleTabs = gBrowser.visibleTabs.length > 1;
-    document.getElementById("toolbar-context-reloadAllTabs").disabled = !haveMultipleTabs;
-    document.getElementById("toolbar-context-bookmarkSelectedTabs").hidden = !gBrowser.multiSelectedTabsCount;
-    document.getElementById("toolbar-context-bookmarkSelectedTab").hidden = !!gBrowser.multiSelectedTabsCount;
+    let multipleTabsSelected = !!gBrowser.multiSelectedTabsCount;
+    document.getElementById("toolbar-context-bookmarkSelectedTabs").hidden = !multipleTabsSelected;
+    document.getElementById("toolbar-context-bookmarkSelectedTab").hidden = multipleTabsSelected;
+    document.getElementById("toolbar-context-reloadSelectedTabs").hidden = !multipleTabsSelected;
+    document.getElementById("toolbar-context-reloadSelectedTab").hidden = multipleTabsSelected;
     document.getElementById("toolbar-context-selectAllTabs").disabled = gBrowser.allTabsSelected();
     document.getElementById("toolbar-context-undoCloseTab").disabled =
       SessionStore.getClosedTabCount(window) == 0;
     return;
   }
 
   // In some cases, we will exit the above loop with toolbarItem being the
   // xul:document. That has no parentNode, and we should disable the items in
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -186,20 +186,16 @@ xmlns="http://www.w3.org/1999/xhtml"
         </menupopup>
       </menu>
       <menu id="context_sendTabToDevice"
             class="sync-ui-item">
         <menupopup id="context_sendTabToDevicePopupMenu"
                    onpopupshowing="gSync.populateSendTabToDevicesMenu(event.target, TabContextMenu.contextTab.linkedBrowser.currentURI.spec, TabContextMenu.contextTab.linkedBrowser.contentTitle, TabContextMenu.contextTab.multiselected);"/>
       </menu>
       <menuseparator/>
-      <menuitem id="context_reloadAllTabs" label="&reloadAllTabs.label;" accesskey="&reloadAllTabs.accesskey;"
-                tbattr="tabbrowser-multiple-visible"
-                oncommand="gBrowser.reloadAllTabs();"/>
-      <menuseparator/>
       <menu id="context_closeTabOptions"
             label="&closeTabOptions.label;"
             accesskey="&closeTabOptions.accesskey;">
         <menupopup id="closeOtherTabsMenu">
           <menuitem id="context_closeTabsToTheEnd" label="&closeTabsToTheEnd.label;" accesskey="&closeTabsToTheEnd.accesskey;"
                     oncommand="gBrowser.removeTabsToTheEndFrom(TabContextMenu.contextTab, {animate: true});"/>
           <menuitem id="context_closeOtherTabs" label="&closeOtherTabs.label;" accesskey="&closeOtherTabs.accesskey;"
                     oncommand="gBrowser.removeAllTabsBut(TabContextMenu.contextTab);"/>
@@ -444,22 +440,28 @@ xmlns="http://www.w3.org/1999/xhtml"
                 label="&customizeMenu.autoHideDownloadsButton.label;"
                 contexttype="toolbaritem"
                 class="customize-context-autoHide"/>
       <menuitem oncommand="gCustomizeMode.removeFromArea(document.popupNode)"
                 accesskey="&customizeMenu.removeFromToolbar.accesskey;"
                 label="&customizeMenu.removeFromToolbar.label;"
                 contexttype="toolbaritem"
                 class="customize-context-removeFromToolbar"/>
-      <menuitem id="toolbar-context-reloadAllTabs"
+      <menuitem id="toolbar-context-reloadSelectedTab"
                 class="toolbaritem-tabsmenu"
                 contexttype="tabbar"
-                oncommand="gBrowser.reloadAllTabs();"
-                label="&toolbarContextMenu.reloadAllTabs.label;"
-                accesskey="&toolbarContextMenu.reloadAllTabs.accesskey;"/>
+                oncommand="gBrowser.reloadMultiSelectedTabs();"
+                label="&toolbarContextMenu.reloadSelectedTab.label;"
+                accesskey="&toolbarContextMenu.reloadSelectedTab.accesskey;"/>
+      <menuitem id="toolbar-context-reloadSelectedTabs"
+                class="toolbaritem-tabsmenu"
+                contexttype="tabbar"
+                oncommand="gBrowser.reloadMultiSelectedTabs();"
+                label="&toolbarContextMenu.reloadSelectedTabs.label;"
+                accesskey="&toolbarContextMenu.reloadSelectedTabs.accesskey;"/>
       <menuitem id="toolbar-context-bookmarkSelectedTab"
                 class="toolbaritem-tabsmenu"
                 contexttype="tabbar"
                 oncommand="PlacesCommandHook.bookmarkPages(PlacesCommandHook.uniqueSelectedPages);"
                 label="&toolbarContextMenu.bookmarkSelectedTab.label;"
                 accesskey="&toolbarContextMenu.bookmarkSelectedTab.accesskey;"/>
       <menuitem id="toolbar-context-bookmarkSelectedTabs"
                 class="toolbaritem-tabsmenu"
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -3398,20 +3398,16 @@ window._gBrowser = {
       aOurBrowser.registeredOpenURI = aOtherBrowser.registeredOpenURI;
       delete aOtherBrowser.registeredOpenURI;
     }
     if (tmp) {
       aOtherBrowser.registeredOpenURI = tmp;
     }
   },
 
-  reloadAllTabs() {
-    this.reloadTabs(this.visibleTabs);
-  },
-
   reloadMultiSelectedTabs() {
     this.reloadTabs(this.selectedTabs);
   },
 
   reloadTabs(tabs) {
     for (let tab of tabs) {
       try {
         this.getBrowserForTab(tab).reload();
--- a/browser/base/content/test/permissions/browser_temporary_permissions_navigation.js
+++ b/browser/base/content/test/permissions/browser_temporary_permissions_navigation.js
@@ -75,23 +75,26 @@ add_task(async function testTempPermissi
 // Test that temporary permissions are not removed when reloading all tabs.
 add_task(async function testTempPermissionOnReloadAllTabs() {
   let uri = NetUtil.newURI("https://example.com");
   let id = "geo";
 
   await BrowserTestUtils.withNewTab(uri.spec, async function(browser) {
     SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, browser);
 
+    // Select all tabs before opening the context menu.
+    gBrowser.selectAllTabs();
+
     // Open the tab context menu.
     let contextMenu = document.getElementById("tabContextMenu");
     let popupShownPromise = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
     EventUtils.synthesizeMouseAtCenter(gBrowser.selectedTab, {type: "contextmenu", button: 2});
     await popupShownPromise;
 
-    let reloadMenuItem = document.getElementById("context_reloadAllTabs");
+    let reloadMenuItem = document.getElementById("context_reloadSelectedTabs");
 
     let reloaded = Promise.all(gBrowser.visibleTabs.map(
       tab => BrowserTestUtils.browserLoaded(gBrowser.getBrowserForTab(tab))));
     EventUtils.synthesizeMouseAtCenter(reloadMenuItem, {});
     await reloaded;
 
     Assert.deepEqual(SitePermissions.get(uri, id, browser), {
       state: SitePermissions.BLOCK,
--- a/browser/base/content/test/tabs/browser_visibleTabs_contextMenu.js
+++ b/browser/base/content/test/tabs/browser_visibleTabs_contextMenu.js
@@ -9,27 +9,25 @@ add_task(async function test() {
   let [origTab] = gBrowser.visibleTabs;
   is(gBrowser.visibleTabs.length, 1, "there is one visible tab");
   let testTab = BrowserTestUtils.addTab(gBrowser);
   is(gBrowser.visibleTabs.length, 2, "there are now two visible tabs");
 
   // Check the context menu with two tabs
   updateTabContextMenu(origTab);
   is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled");
-  is(document.getElementById("context_reloadAllTabs").disabled, false, "Reload All Tabs is enabled");
 
   // Hide the original tab.
   gBrowser.selectedTab = testTab;
   gBrowser.showOnlyTheseTabs([testTab]);
   is(gBrowser.visibleTabs.length, 1, "now there is only one visible tab");
 
   // Check the context menu with one tab.
   updateTabContextMenu(testTab);
   is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled when more than one tab exists");
-  is(document.getElementById("context_reloadAllTabs").disabled, true, "Reload All Tabs is disabled");
 
   // Add a tab that will get pinned
   // So now there's one pinned tab, one visible unpinned tab, and one hidden tab
   let pinned = BrowserTestUtils.addTab(gBrowser);
   gBrowser.pinTab(pinned);
   is(gBrowser.visibleTabs.length, 2, "now there are two visible tabs");
 
   // Check the context menu on the pinned tab
--- a/browser/components/customizableui/test/browser_customization_context_menus.js
+++ b/browser/components/customizableui/test/browser_customization_context_menus.js
@@ -51,17 +51,17 @@ add_task(async function tabstrip_context
   let tabstrip = document.getElementById("tabbrowser-tabs");
   let rect = tabstrip.getBoundingClientRect();
   EventUtils.synthesizeMouse(tabstrip, rect.width - 2, 2, {type: "contextmenu", button: 2 });
   await shownPromise;
 
   let closedTabsAvailable = SessionStore.getClosedTabCount(window) == 0;
   info("Closed tabs: " + closedTabsAvailable);
   let expectedEntries = [
-    ["#toolbar-context-reloadAllTabs", true],
+    ["#toolbar-context-reloadSelectedTab", true],
     ["#toolbar-context-bookmarkSelectedTab", true],
     ["#toolbar-context-selectAllTabs", true],
     ["#toolbar-context-undoCloseTab", !closedTabsAvailable],
     ["---"],
   ];
   if (!isOSX) {
     expectedEntries.push(["#toggle_toolbar-menubar", true]);
   }
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -16,18 +16,16 @@
 <!ENTITY mainWindow.titlePrivateBrowsingSuffix "(Private Browsing)">
 
 <!ENTITY appmenu.tooltip                     "Open menu">
 <!ENTITY navbarOverflow.label                "More tools…">
 
 <!-- Tab context menu -->
 <!ENTITY  reloadTab.label                    "Reload Tab">
 <!ENTITY  reloadTab.accesskey                "R">
-<!ENTITY  reloadAllTabs.label                "Reload All Tabs">
-<!ENTITY  reloadAllTabs.accesskey            "A">
 <!ENTITY  selectAllTabs.label                "Select All Tabs">
 <!ENTITY  selectAllTabs.accesskey            "S">
 <!-- LOCALIZATION NOTE (duplicateTab.label): This is a command to duplicate
 a tab (i.e. it is a verb, not adjective). -->
 <!ENTITY  duplicateTab.label                 "Duplicate Tab">
 <!ENTITY  duplicateTab.accesskey             "D">
 <!ENTITY  closeTabOptions.label              "Close Tab Options">
 <!ENTITY  closeTabOptions.accesskey          "O">
@@ -128,18 +126,26 @@ when there are no windows but Firefox is
 
 <!ENTITY menubarCmd.label "Menu Bar">
 <!ENTITY menubarCmd.accesskey "M">
 <!ENTITY navbarCmd.label "Navigation Toolbar">
 <!ENTITY personalbarCmd.label "Bookmarks Toolbar">
 <!ENTITY personalbarCmd.accesskey "B">
 <!ENTITY bookmarksToolbarItem.label "Bookmarks Toolbar Items">
 
-<!ENTITY toolbarContextMenu.reloadAllTabs.label "Reload All Tabs">
-<!ENTITY toolbarContextMenu.reloadAllTabs.accesskey "A">
+<!ENTITY toolbarContextMenu.reloadSelectedTab.label "Reload Selected Tab">
+<!-- LOCALIZATION NOTE (toolbarContextMenu.reloadSelectedTab.accesskey,
+toolbarContextMenu.reloadSelectedTabs.accesskey): These share the
+same accesskey but will never be visible at the same time. -->
+<!ENTITY toolbarContextMenu.reloadSelectedTab.accesskey "R">
+<!ENTITY toolbarContextMenu.reloadSelectedTabs.label "Reload Selected Tabs">
+<!-- LOCALIZATION NOTE (toolbarContextMenu.reloadSelectedTab.accesskey,
+toolbarContextMenu.reloadSelectedTabs.accesskey): These share the
+same accesskey but will never be visible at the same time. -->
+<!ENTITY toolbarContextMenu.reloadSelectedTabs.accesskey "R">
 <!ENTITY toolbarContextMenu.bookmarkSelectedTab.label "Bookmark Selected Tab…">
 <!-- LOCALIZATION NOTE (toolbarContextMenu.bookmarkSelectedTab.accesskey,
 toolbarContextMenu.bookmarkSelectedTabs.accesskey): These share the
 same accesskey but will never be visible at the same time. -->
 <!ENTITY toolbarContextMenu.bookmarkSelectedTab.accesskey "T">
 <!ENTITY toolbarContextMenu.bookmarkSelectedTabs.label "Bookmark Selected Tabs…">
 <!-- LOCALIZATION NOTE (toolbarContextMenu.bookmarkSelectedTab.accesskey,
 toolbarContextMenu.bookmarkSelectedTabs.accesskey): These share the