Bug 1287914 - Buttons in sliding panel overlay are not clickable. r=jaws

MozReview-Commit-ID: 91yoPxiMIy8
This commit is contained in:
Drew Willcoxon 2016-07-28 11:51:53 -07:00
Родитель 6dc54f7d80
Коммит a21a61d78d
2 изменённых файлов: 28 добавлений и 13 удалений

Просмотреть файл

@ -1196,7 +1196,17 @@ const DownloadsViewController = {
!(aCommand in DownloadsViewItem.prototype)) {
return false;
}
// Secondly, determine if focus is on a control in the downloads list.
// 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.
let element = document.commandDispatcher.focusedElement;
while (element && element != DownloadsView.richListBox) {
element = element.parentNode;
@ -1606,6 +1616,9 @@ 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();
},
/**

Просмотреть файл

@ -39,7 +39,8 @@ add_task(function* mainTest() {
// Click the Open button. The alert blocked-download dialog should be
// shown.
let dialogPromise = promiseAlertDialogOpen("cancel");
DownloadsBlockedSubview.elements.openButton.click();
EventUtils.synthesizeMouse(DownloadsBlockedSubview.elements.openButton,
10, 10, {}, window);
yield dialogPromise;
window.focus();
@ -53,7 +54,8 @@ add_task(function* mainTest() {
// Click the Remove button. The panel should close and the item should be
// removed from it.
DownloadsBlockedSubview.elements.deleteButton.click();
EventUtils.synthesizeMouse(DownloadsBlockedSubview.elements.deleteButton,
10, 10, {}, window);
yield promisePanelHidden();
yield openPanel();
@ -150,16 +152,16 @@ function makeDownload(verdict) {
}
function promiseSubviewShown(shown) {
// More terribleness, but I'm tired of fighting intermittent timeouts on try.
// Just poll for the subview and wait a second before resolving the promise.
return new Promise(resolve => {
if (shown == DownloadsBlockedSubview.view.showingSubView) {
resolve();
return;
}
let event = shown ? "ViewShowing" : "ViewHiding";
let subview = DownloadsBlockedSubview.subview;
subview.addEventListener(event, function showing() {
subview.removeEventListener(event, showing);
resolve();
});
let interval = setInterval(() => {
if (shown == DownloadsBlockedSubview.view.showingSubView &&
!DownloadsBlockedSubview.view._transitioning) {
clearInterval(interval);
setTimeout(resolve, 1000);
return;
}
}, 0);
});
}