Bug 1242562 - Byte count rounding shouldn't depend on the decimal separator used. r=mak draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 07 May 2016 17:14:20 +0200
changeset 364672 879723577fd26c51e762594135aa61a59b501f51
parent 363866 11d0a44821268702e8cfc508bdb4cf037013697c
child 520359 ecfd38f2c8afa2655397f1c652966f367a3354d3
push id17535
push usermozilla@buttercookie.de
push dateSat, 07 May 2016 15:55:43 +0000
reviewersmak
bugs1242562
milestone49.0a1
Bug 1242562 - Byte count rounding shouldn't depend on the decimal separator used. r=mak Currently, download sizes on Fennec aren't rounded for locales using a "." as their decimal separator. MozReview-Commit-ID: 54sBvTrNAln
toolkit/mozapps/downloads/DownloadUtils.jsm
--- a/toolkit/mozapps/downloads/DownloadUtils.jsm
+++ b/toolkit/mozapps/downloads/DownloadUtils.jsm
@@ -481,19 +481,22 @@ this.DownloadUtils = {
 
     // Don't try to format Infinity values using NumberFormat.
     if (aBytes === Infinity) {
       aBytes = "Infinity";
     } else {
       if (typeof Intl != "undefined") {
         aBytes = getLocaleNumberFormat(fractionDigits)
                    .format(aBytes);
-      } else if (gDecimalSymbol != ".") {
+      } else {
         // FIXME: Fall back to the old hack, will be fixed in bug 1200494.
-        aBytes = aBytes.toFixed(fractionDigits).replace(".", gDecimalSymbol);
+        aBytes = aBytes.toFixed(fractionDigits);
+        if (gDecimalSymbol != ".") {
+          aBytes = aBytes.replace(".", gDecimalSymbol);
+        }
       }
     }
 
     return [aBytes, gBundle.GetStringFromName(gStr.units[unitIndex])];
   },
 
   /**
    * Converts a number of seconds to the two largest units. Time values are