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
--- 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