diff --git a/browser/components/downloads/content/downloads.js b/browser/components/downloads/content/downloads.js index 0ec081b315c2..7617fe7fe20d 100644 --- a/browser/components/downloads/content/downloads.js +++ b/browser/components/downloads/content/downloads.js @@ -1194,17 +1194,7 @@ const DownloadsViewController = { !(aCommand in DownloadsViewItem.prototype)) { return false; } - // The currently supported commands depend on whether the blocked subview is - // showing. If it is, then take the following path. - if (DownloadsBlockedSubview.view.showingSubView) { - let blockedSubviewCmds = [ - "downloadsCmd_chooseOpen", - "cmd_delete", - ]; - return blockedSubviewCmds.indexOf(aCommand) >= 0; - } - // If the blocked subview is not showing, then determine if focus is on a - // control in the downloads list. + // Secondly, determine if focus is on a control in the downloads list. let element = document.commandDispatcher.focusedElement; while (element && element != DownloadsView.richListBox) { element = element.parentNode; @@ -1614,9 +1604,6 @@ const DownloadsBlockedSubview = { */ hide() { this.view.showMainView(); - // The point of this is to focus the proper element in the panel now that - // the main view is showing again. showPanel handles that. - DownloadsPanel.showPanel(); }, /** diff --git a/browser/components/downloads/test/browser/browser_downloads_panel_block.js b/browser/components/downloads/test/browser/browser_downloads_panel_block.js index 5c248976c4e4..edaf21253f85 100644 --- a/browser/components/downloads/test/browser/browser_downloads_panel_block.js +++ b/browser/components/downloads/test/browser/browser_downloads_panel_block.js @@ -39,8 +39,7 @@ add_task(function* mainTest() { // Click the Open button. The alert blocked-download dialog should be // shown. let dialogPromise = promiseAlertDialogOpen("cancel"); - EventUtils.synthesizeMouse(DownloadsBlockedSubview.elements.openButton, - 10, 10, {}, window); + DownloadsBlockedSubview.elements.openButton.click(); yield dialogPromise; window.focus(); @@ -54,8 +53,7 @@ add_task(function* mainTest() { // Click the Remove button. The panel should close and the item should be // removed from it. - EventUtils.synthesizeMouse(DownloadsBlockedSubview.elements.deleteButton, - 10, 10, {}, window); + DownloadsBlockedSubview.elements.deleteButton.click(); yield promisePanelHidden(); yield openPanel(); @@ -153,24 +151,15 @@ function makeDownload(verdict) { function promiseSubviewShown(shown) { return new Promise(resolve => { - if (shown == DownloadsBlockedSubview.view.showingSubView && - !DownloadsBlockedSubview.view._transitioning) { - info("promiseSubviewShown: already showing"); + if (shown == DownloadsBlockedSubview.view.showingSubView) { resolve(); return; } - let subviews = DownloadsBlockedSubview.view._subViews; - let onTransition = event => { - info("promiseSubviewShown: transitionend observed," + - " target=" + event.target + - " target.className=" + event.target.className); - if (event.target == subviews) { - info("promiseSubviewShown: got transitionend"); - subviews.removeEventListener("transitionend", onTransition); - setTimeout(resolve, 0); - } - }; - subviews.addEventListener("transitionend", onTransition); - info("promiseSubviewShown: waiting on transitionend"); + let event = shown ? "ViewShowing" : "ViewHiding"; + let subview = DownloadsBlockedSubview.subview; + subview.addEventListener(event, function showing() { + subview.removeEventListener(event, showing); + resolve(); + }); }); }