Bug 1242562 - Byte count rounding shouldn't depend on the decimal separator used. r=mak
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 07 May 2016 17:14:20 +0200
changeset 296879 7f5cb264eb70c1ed2680fc4487e4fafc72f2e2b6
parent 296878 68fddeb3a7dbc1adc7b8b8841523ec48961add04
child 296880 9e428c5047b338037c9452bdfcb09a487ea5f0e8
push id30248
push usercbook@mozilla.com
push dateWed, 11 May 2016 12:51:10 +0000
treeherdermozilla-central@91714307a799 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1242562
milestone49.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 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