Bug 1354532 - Part 5 - Make sure to only show completed downloads in the Library panel subview. r?paolo draft
authorMike de Boer <mdeboer@mozilla.com>
Tue, 11 Jul 2017 12:24:20 +0200
changeset 606723 aa893d1ce09cc3b8127ef7df3060ed43a4797942
parent 606722 0f336a4287370ebf86eb258b98186a3fe755081a
child 606724 18a78caf7e568291c3f524f48d45935643d552ec
push id67791
push usermdeboer@mozilla.com
push dateTue, 11 Jul 2017 10:33:03 +0000
reviewerspaolo
bugs1354532
milestone56.0a1
Bug 1354532 - Part 5 - Make sure to only show completed downloads in the Library panel subview. r?paolo MozReview-Commit-ID: GcsK0INO5Z3
browser/components/downloads/DownloadsPanelSubView.jsm
browser/components/downloads/DownloadsViewUI.jsm
--- 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();
   },
 
   /**