Bug 991965 - Inhibit mouse events if a DownloadsBlockedSubview is open
MozReview-Commit-ID: Akly0NenY8Z
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -723,16 +723,21 @@ const DownloadsView = {
kItemCountLimit: 5,
/**
* Indicates whether there is an open contextMenu for a download item.
*/
contextMenuOpen: false,
/**
+ * Indicates whether there is a DownloadsBlockedSubview open.
+ */
+ subViewOpen: false,
+
+ /**
* Indicates whether we are still loading downloads data asynchronously.
*/
loading: false,
/**
* Ordered array of all Download objects. We need to keep this array because
* only a limited number of items are shown at once, and if an item that is
* currently visible is removed from the list, we might need to take another
@@ -1027,24 +1032,24 @@ const DownloadsView = {
DownloadsCommon.log("Context menu has hidden.");
this.contextMenuOpen = false;
},
/**
* Mouse listeners to handle selection on hover.
*/
onDownloadMouseOver(aEvent) {
- if (!this.contextMenuOpen &&
+ if (!(this.contextMenuOpen || this.subViewOpen) &&
aEvent.target.parentNode == this.richListBox) {
this.richListBox.selectedItem = aEvent.target;
}
},
onDownloadMouseOut(aEvent) {
- if (!this.contextMenuOpen &&
+ if (!(this.contextMenuOpen || this.subViewOpen) &&
aEvent.target.parentNode == this.richListBox) {
// If the destination element is outside of the richlistitem, clear the
// selection.
let element = aEvent.relatedTarget;
while (element && element != aEvent.target) {
element = element.parentNode;
}
if (!element) {
@@ -1666,16 +1671,17 @@ const DownloadsBlockedSubview = {
toggle(element, title, details) {
if (this.view.showingSubView) {
this.hide();
return;
}
this.element = element;
element.setAttribute("showingsubview", "true");
+ DownloadsView.subViewOpen = true;
let e = this.elements;
let s = DownloadsCommon.strings;
e.title.textContent = title;
e.details1.textContent = details[0];
e.details2.textContent = details[1];
e.openButton.label = s.unblockButtonOpen;
e.deleteButton.label = s.unblockButtonConfirmBlock;
@@ -1692,16 +1698,17 @@ const DownloadsBlockedSubview = {
window.getComputedStyle(this.view).width;
},
handleEvent(event) {
switch (event.type) {
case "ViewHiding":
this.subview.removeEventListener(event.type, this);
this.element.removeAttribute("showingsubview");
+ DownloadsView.subViewOpen = false;
delete this.element;
break;
default:
DownloadsCommon.log("Unhandled DownloadsBlockedSubview event: " +
event.type);
break;
}
},