зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset b12b76bbe1c6 (bug 1452970) for TV failures in browser/components/downloads/test/browser/browser_downloads_autohide.js on a CLOSED TREE
This commit is contained in:
Родитель
0584c2911d
Коммит
88da23b0b7
|
@ -6368,22 +6368,6 @@ 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 <browser> element (or, more specifically, a
|
||||
// browser's permanentKey) to an Object that contains the most recent
|
||||
|
|
|
@ -332,18 +332,12 @@
|
|||
</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;"
|
||||
|
|
|
@ -288,57 +288,6 @@ add_task(async function checkStateWhenHiddenInPalette() {
|
|||
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,
|
||||
|
@ -355,20 +304,3 @@ 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();
|
||||
}
|
||||
|
|
|
@ -426,8 +426,6 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
|||
<!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
|
||||
|
|
Загрузка…
Ссылка в новой задаче