Bug 1392270 - Fix download.estimatedEndTime calculation. r=aswan draft
authorTim Nguyen <ntim.bugs@gmail.com>
Tue, 22 Aug 2017 20:32:11 +0200
changeset 650701 be06517bd1bee99676a3bedd6fb16f35f82e788b
parent 649939 8ee92d1199550708e5fefb66099405ff676fd41a
child 727468 3d1d80839f4500618879aacecf1be0ddde984ca4
push id75467
push userbmo:ntim.bugs@gmail.com
push dateTue, 22 Aug 2017 18:33:01 +0000
reviewersaswan
bugs1392270
milestone57.0a1
Bug 1392270 - Fix download.estimatedEndTime calculation. r=aswan MozReview-Commit-ID: HqyYLtTC3N6
toolkit/components/extensions/ext-downloads.js
--- a/toolkit/components/extensions/ext-downloads.js
+++ b/toolkit/components/extensions/ext-downloads.js
@@ -61,18 +61,18 @@ class DownloadItem {
   get danger() { return "safe"; } // TODO
   get mime() { return this.download.contentType; }
   get startTime() { return this.download.startTime; }
   get endTime() { return null; } // TODO
   get estimatedEndTime() {
     // Based on the code in summarizeDownloads() in DownloadsCommon.jsm
     if (this.download.hasProgress && this.download.speed > 0) {
       let sizeLeft = this.download.totalBytes - this.download.currentBytes;
-      let rawTimeLeft = sizeLeft / this.download.speed;
-      return new Date(Date.now() + rawTimeLeft);
+      let timeLeftInSeconds  = sizeLeft / this.download.speed;
+      return new Date(Date.now() + (timeLeftInSeconds * 1000));
     }
   }
   get state() {
     if (this.download.succeeded) {
       return "complete";
     }
     if (this.download.canceled) {
       return "interrupted";