Bug 1354532 - Part 5 - Make sure to only show completed downloads in the Library panel subview. r?paolo
MozReview-Commit-ID: GcsK0INO5Z3
--- a/browser/components/downloads/DownloadsPanelSubView.jsm
+++ b/browser/components/downloads/DownloadsPanelSubView.jsm
@@ -93,16 +93,17 @@ class DownloadsPanelSubView extends Down
get selectedNodes() {
let selectedNode = this.selectedNode;
return selectedNode ? [selectedNode] : [];
}
onInsertElement(element, placesNode) {
this._addDownloadData(null, placesNode, false, null, element);
+ element.hidden = !element._shell.download.succeeded;
element._shell.element = element;
element._shell.ensureActive();
element.classList.add("download", "download-state");
element.setAttribute("image", element._shell.image);
let fullStatus = element._shell.statusLabels.fullStatus;
element.setAttribute("fullStatus", fullStatus);
element.setAttribute("tooltiptext", fullStatus);
if (element._shell.isCommandEnabled("downloadsCmd_show")) {
--- a/browser/components/downloads/DownloadsViewUI.jsm
+++ b/browser/components/downloads/DownloadsViewUI.jsm
@@ -441,16 +441,20 @@ this.DownloadsViewUI.DownloadElementShel
if (!this.download.succeeded && this.download.error &&
this.download.error.becauseBlockedByReputationCheck) {
this.element.setAttribute("verdict",
this.download.error.reputationCheckVerdict);
} else {
this.element.removeAttribute("verdict");
}
+ // Some views only show completed downloads, so make sure to un-hide the
+ // element when that happens.
+ if (this.element.hidden && this.download.succeeded)
+ this.element.hidden = false;
// Since state changed, reset the time left estimation.
this.lastEstimatedSecondsLeft = Infinity;
this._updateProgress();
},
/**