Backed out changeset b12b76bbe1c6 (bug 1452970) for TV failures in browser/components/downloads/test/browser/browser_downloads_autohide.js on a CLOSED TREE
authorshindli <shindli@mozilla.com>
Wed, 09 May 2018 15:16:40 +0300
changeset 417548 bd9355f65718f3eb1dc3d1e913c2943fe3dd8294
parent 417547 a42df29b0d3dc2219a39535661655da216dbb5b1
child 417549 4614964298a87a20ad4cad2c721d25889b949b18
push id33970
push usercsabou@mozilla.com
push dateWed, 09 May 2018 17:26:50 +0000
treeherdermozilla-central@d4d7e793ebe8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1452970
milestone62.0a1
backs outb12b76bbe1c655bdf18b4456add8aa7207d8ac08
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
Backed out changeset b12b76bbe1c6 (bug 1452970) for TV failures in browser/components/downloads/test/browser/browser_downloads_autohide.js on a CLOSED TREE
browser/base/content/browser.js
browser/base/content/browser.xul
browser/components/downloads/test/browser/browser_downloads_autohide.js
browser/locales/en-US/chrome/browser/browser.dtd
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6363,32 +6363,16 @@ function BrowserCharsetReload() {
 function UpdateCurrentCharset(target) {
   let selectedCharset = CharsetMenu.foldCharset(gBrowser.selectedBrowser.characterSet);
   for (let menuItem of target.getElementsByTagName("menuitem")) {
     let isSelected = menuItem.getAttribute("charset") === selectedCharset;
     menuItem.setAttribute("checked", isSelected);
   }
 }
 
-function UpdateDownloadsAutoHide(popup) {
-  let checkbox = popup.querySelector(".customize-context-autoHide");
-  let isDownloads = popup.triggerNode && ["downloads-button", "wrapper-downloads-button"].includes(popup.triggerNode.id);
-  checkbox.hidden = !isDownloads;
-  if (this.window.DownloadsButton.autoHideDownloadsButton) {
-    checkbox.setAttribute("checked", "true");
-  } else {
-    checkbox.removeAttribute("checked");
-  }
-}
-
-function onDownloadsAutoHideChange(event) {
-  let autoHide = event.target.getAttribute("checked") == "true";
-  Services.prefs.setBoolPref("browser.download.autohideButton", autoHide);
-}
-
 var gPageStyleMenu = {
   // This maps from a <browser> element (or, more specifically, a
   // browser's permanentKey) to an Object that contains the most recent
   // information about the browser content's stylesheets. That Object
   // is populated via the PageStyle:StyleSheets message from the content
   // process. The Object should have the following structure:
   //
   // filteredStyleSheets (Array):
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -327,28 +327,22 @@
                      oncommand="SidebarUI.reversePosition()"/>
       <toolbarseparator/>
       <toolbarbutton label="&sidebarMenuClose.label;"
                      class="subviewbutton"
                      oncommand="SidebarUI.hide()"/>
     </panel>
 
     <menupopup id="toolbar-context-menu"
-               onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator')); UpdateDownloadsAutoHide(this)">
+               onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator'));">
       <menuitem oncommand="gCustomizeMode.addToPanel(document.popupNode)"
                 accesskey="&customizeMenu.pinToOverflowMenu.accesskey;"
                 label="&customizeMenu.pinToOverflowMenu.label;"
                 contexttype="toolbaritem"
                 class="customize-context-moveToPanel"/>
-      <menuitem oncommand="onDownloadsAutoHideChange(event)"
-                type="checkbox"
-                accesskey="&customizeMenu.autoHideDownloadsButton.accesskey;"
-                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"
                 class="toolbaritem-tabsmenu"
                 contexttype="tabbar"
--- a/browser/components/downloads/test/browser/browser_downloads_autohide.js
+++ b/browser/components/downloads/test/browser/browser_downloads_autohide.js
@@ -283,92 +283,24 @@ add_task(async function checkStateWhenHi
     // It doesn't really matter if the button remains unhidden in
     // the palette, and if we move it we'll unhide it then (the other
     // tests check this).
   }
   await BrowserTestUtils.closeWindow(otherWin);
   CustomizableUI.reset();
 });
 
-add_task(async function checkContextMenu() {
-  let contextMenu = document.getElementById("toolbar-context-menu");
-  let checkbox = contextMenu.querySelector(".customize-context-autoHide");
-  let button = document.getElementById("downloads-button");
-
-  is(Services.prefs.getBoolPref(kDownloadAutoHidePref), true,
-     "Pref should be causing us to autohide");
-  is(DownloadsIndicatorView.hasDownloads, false,
-     "Should be no downloads when starting the test");
-  is(button.hidden, true, "Downloads button is hidden");
-
-  info("Simulate a download to show the downloads button.");
-  DownloadsIndicatorView.hasDownloads = true;
-  is(button.hidden, false, "Downloads button is visible");
-
-  info("Check context menu");
-  await openContextMenu(button);
-  is(checkbox.hidden, false, "Auto-hide checkbox is visible");
-  is(checkbox.getAttribute("checked"), "true", "Auto-hide is enabled");
-
-  info("Disable auto-hide via context menu");
-  clickCheckbox(checkbox);
-  is(Services.prefs.getBoolPref(kDownloadAutoHidePref), false,
-     "Pref has been set to false");
-
-  info("Clear downloads");
-  DownloadsIndicatorView.hasDownloads = false;
-  is(button.hidden, false, "Downloads button is still visible");
-
-  info("Check context menu");
-  await openContextMenu(button);
-  is(checkbox.hidden, false, "Auto-hide checkbox is visible");
-  is(checkbox.hasAttribute("checked"), false, "Auto-hide is disabled");
-
-  info("Enable auto-hide via context menu");
-  clickCheckbox(checkbox);
-  is(button.hidden, true, "Downloads button is hidden");
-  is(Services.prefs.getBoolPref(kDownloadAutoHidePref), true,
-     "Pref has been set to true");
-
-  info("Check context menu in another button");
-  await openContextMenu(document.getElementById("home-button"));
-  is(checkbox.hidden, true, "Auto-hide checkbox is hidden");
-  contextMenu.hidePopup();
-
-  info("Open popup directly");
-  contextMenu.showPopup();
-  is(checkbox.hidden, true, "Auto-hide checkbox is hidden");
-  contextMenu.hidePopup();
-});
-
 function promiseCustomizeStart(aWindow = window) {
   return new Promise(resolve => {
     aWindow.gNavToolbox.addEventListener("customizationready", resolve,
                                          {once: true});
     aWindow.gCustomizeMode.enter();
   });
 }
 
 function promiseCustomizeEnd(aWindow = window) {
   return new Promise(resolve => {
     aWindow.gNavToolbox.addEventListener("aftercustomization", resolve,
                                          {once: true});
     aWindow.gCustomizeMode.exit();
   });
 }
 
-async function openContextMenu(element) {
-  let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
-  EventUtils.synthesizeMouseAtCenter(element, {type: "contextmenu", button: 2});
-  await popupShownPromise;
-}
-
-function clickCheckbox(checkbox) {
-  // Clicking a checkbox toggles its checkedness first.
-  if (checkbox.getAttribute("checked") == "true") {
-    checkbox.removeAttribute("checked");
-  } else {
-    checkbox.setAttribute("checked", "true");
-  }
-  // Then it runs the command and closes the popup.
-  checkbox.doCommand();
-  checkbox.parentElement.hidePopup();
-}
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -421,18 +421,16 @@ These should match what Safari and other
 <!ENTITY customizeMenu.unpinFromOverflowMenu.label "Unpin from Overflow Menu">
 <!ENTITY customizeMenu.unpinFromOverflowMenu.accesskey "U">
 <!ENTITY customizeMenu.removeFromToolbar.label "Remove from Toolbar">
 <!ENTITY customizeMenu.removeFromToolbar.accesskey "R">
 <!ENTITY customizeMenu.removeFromMenu.label "Remove from Menu">
 <!ENTITY customizeMenu.removeFromMenu.accesskey "R">
 <!ENTITY customizeMenu.addMoreItems.label "Add More Items…">
 <!ENTITY customizeMenu.addMoreItems.accesskey "A">
-<!ENTITY customizeMenu.autoHideDownloadsButton.label "Auto-Hide in Toolbar">
-<!ENTITY customizeMenu.autoHideDownloadsButton.accesskey "A">
 
 <!-- LOCALIZATION NOTE (moreMenu.label) This label is used in the new Photon
     app (hamburger) menu. When clicked, it opens a subview that contains
     secondary commands. -->
 <!ENTITY moreMenu.label "More">
 
 <!ENTITY openCmd.commandkey           "l">
 <!ENTITY urlbar.placeholder2          "Search or enter address">