Bug 910597 - Downloaded amount is always reported as unknown size. r=mbrubeck
authorBrian R. Bondy <netzen@gmail.com>
Tue, 17 Sep 2013 07:04:01 -0700
changeset 147578 db58872e6aaf9097ff5d2e449fe084a2c31b06de
parent 147577 d7c49f9c66c3ece33173c61fbbe35a7aba3e9172
child 147579 e1dfb1746f9666d47ae6bf1acd5c7a853d17bd6c
push id25307
push userryanvm@gmail.com
push dateWed, 18 Sep 2013 02:44:29 +0000
treeherdermozilla-central@44f4567699ff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs910597
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 910597 - Downloaded amount is always reported as unknown size. r=mbrubeck
browser/metro/base/content/Util.js
browser/metro/components/HelperAppDialog.js
--- a/browser/metro/base/content/Util.js
+++ b/browser/metro/base/content/Util.js
@@ -171,17 +171,17 @@ let Util = {
   },
 
   /*
    * DownloadUtils.convertByteUnits returns [size, localized-unit-string]
    * so they are joined for a single download size string.
    */
   getDownloadSize: function dv__getDownloadSize (aSize) {
     let [size, units] = DownloadUtils.convertByteUnits(aSize);
-    if (size > 0)
+    if (aSize > 0)
       return size + units;
     else
       return Strings.browser.GetStringFromName("downloadsUnknownSize");
   },
 
   /*
    * URIs and schemes
    */
--- a/browser/metro/components/HelperAppDialog.js
+++ b/browser/metro/components/HelperAppDialog.js
@@ -39,17 +39,18 @@ HelperAppLauncherDialog.prototype = {
     } else {
       let wasClicked = false;
       this._showDownloadInfobar(aLauncher);
     }
   },
 
   _getDownloadSize: function dv__getDownloadSize (aSize) {
     let displaySize = DownloadUtils.convertByteUnits(aSize);
-    if (!isNaN(displaySize[0]) && displaySize[0] > 0) // [0] is size, [1] is units
+    // displaySize[0] is formatted size, displaySize[1] is units
+    if (aSize > 0)
       return displaySize.join("");
     else {
       let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
       return browserBundle.GetStringFromName("downloadsUnknownSize");
     }
   },
 
   _getChromeWindow: function (aWindow) {