diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 661ef17b033c..967a31bfdcfa 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -6368,6 +6368,22 @@ function UpdateCurrentCharset(target) { } } +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 element (or, more specifically, a // browser's permanentKey) to an Object that contains the most recent diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index df702b183796..b0f2a121d8ca 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -332,12 +332,18 @@ + onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator')); UpdateDownloadsAutoHide(this)"> + { aWindow.gNavToolbox.addEventListener("customizationready", resolve, @@ -304,3 +355,20 @@ function promiseCustomizeEnd(aWindow = window) { }); } +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(); +} diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index 7879e62b377a..28526caad3c1 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -426,6 +426,8 @@ These should match what Safari and other Apple applications use on OS X Lion. -- + +