Bug 1392270 - Fix download.estimatedEndTime calculation. r=aswan
MozReview-Commit-ID: HqyYLtTC3N6
--- 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";