Bug 1218317 - Retrieve the file size for finished downloads. r=margaret draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 18 Apr 2016 21:31:17 +0200
changeset 352765 f209f6650d8b58cc6c5b5595fd7a50a992fc2796
parent 352762 dda24f3cd94ab63a2d24618fd42adaa2edd95f68
child 518736 6888dd5236386e7b7791c8a2a7106b11ff7db174
push id15789
push usermozilla@buttercookie.de
push dateMon, 18 Apr 2016 19:32:36 +0000
reviewersmargaret
bugs1218317
milestone48.0a1
Bug 1218317 - Retrieve the file size for finished downloads. r=margaret MozReview-Commit-ID: 2TbC3rs0RyH
mobile/android/chrome/content/aboutDownloads.js
--- a/mobile/android/chrome/content/aboutDownloads.js
+++ b/mobile/android/chrome/content/aboutDownloads.js
@@ -325,17 +325,19 @@ DownloadItem.prototype = {
   get id() {
     return this._id;
   },
   get iconUrl() {
     return this._iconUrl;
   },
 
   get size() {
-    if (this.download.hasProgress) {
+    if (this.download.succeeded && this.download.target.exists) {
+      return DownloadUtils.convertByteUnits(this.download.target.size).join("");
+    } else if (this.download.hasProgress) {
       return DownloadUtils.convertByteUnits(this.download.totalBytes).join("");
     }
     return strings.GetStringFromName("downloadState.unknownSize");
   },
 
   get startDate() {
     return this._startDate;
   },