Bug 1296554 - Show a static progress bar for downloads of unknown size. r=jaws draft
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Mon, 21 Aug 2017 14:52:33 +0100
changeset 649906 85a46233e67e73c4eec79cd02d83a5ad57da1852
parent 649905 cf5e49c0c24855143eacf5ff5c42b29ba976929f
child 727232 bd3630b163ed9453da7b7ad6b9c7903eceeab36f
push id75197
push userpaolo.mozmail@amadzone.org
push dateMon, 21 Aug 2017 14:00:50 +0000
reviewersjaws
bugs1296554
milestone57.0a1
Bug 1296554 - Show a static progress bar for downloads of unknown size. r=jaws MozReview-Commit-ID: HgRl7vlTp3Z
browser/components/downloads/DownloadsCommon.jsm
--- a/browser/components/downloads/DownloadsCommon.jsm
+++ b/browser/components/downloads/DownloadsCommon.jsm
@@ -1216,17 +1216,24 @@ DownloadsIndicatorDataCtor.prototype = {
    */
   _refreshProperties() {
     let summary =
       DownloadsCommon.summarizeDownloads(this._activeDownloads());
 
     // Determine if the indicator should be shown or get attention.
     this._hasDownloads = (this._itemCount > 0);
 
-    this._percentComplete = summary.percentComplete;
+    // Always show a progress bar if there are downloads in progress.
+    if (summary.percentComplete >= 0) {
+      this._percentComplete = summary.percentComplete;
+    } else if (summary.numDownloading > 0) {
+      this._percentComplete = 0;
+    } else {
+      this._percentComplete = -1;
+    }
   }
 };
 
 XPCOMUtils.defineLazyGetter(this, "PrivateDownloadsIndicatorData", function() {
   return new DownloadsIndicatorDataCtor(true);
 });
 
 XPCOMUtils.defineLazyGetter(this, "DownloadsIndicatorData", function() {