Closed Bug 260741 Opened 20 years ago Closed 20 years ago

Wrong download file size in MB is reported

Categories

(Toolkit :: Downloads API, defect, P5)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8final

People

(Reporter: sendyourjunk2me, Assigned: Gavin)

References

()

Details

Attachments

(2 files, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a4) Gecko/20040920 Firefox/0.9.1+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a4) Gecko/20040920 Firefox/0.9.1+

When downloading a file of 19631008 bytes i.e. 18.72MB (from
http://www.nero.com/en/download_previous.php?vpak=1) the download status shows
X.X of 19.2 MB at YY.Y KB/sec. 
After download the files size downloaded was checked and reported by windows as
19631008 bytes 18.7 MB. It seems like a factor of 1.024 is missing, i.e. KB has
been divided by 1000 for MB instead of 1024.
19631008 bytes = 19171 KB (divided by 1024, as reported by Mozilla)
19171KB = 18.72MB (divided by 1024 as reported by Windows, and the Nero download
site)

If you intend using MB as 1000KB and not 1024 KB then suggest leaving the size
reported in KB as in Mozilla to avoid the problem.

Reproducible: Always
Steps to Reproduce:
1. Download file from URL above and compare reported size in MB with actual size
in KB /1024
2.
3.

Actual Results:  
Reported MB as KB/1000

Expected Results:  
Reported MB as KB/1024

Compared with Mozilla nightly which shows download in KB and not in MB
See also  http://www.romulus2.com/articles/guides/misc/bitsbytes.shtml about use
of 1000 and 1024. I think either 1000 or 1024 should be used consistently both
for KB and MB depending on use of decimal or binary systems, and not a mix of
1024 for calculating KB and then 1000 for calculating MB.
Whiteboard: DUPEME
*** Bug 269784 has been marked as a duplicate of this bug. ***
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: DUPEME
Assignee: bugs → gavin.sharp
So my suggestion is to leave the "KB" as is and use 1024 as a base unit
everywhere instead of the 1024/1000 split there is now. This would be consistent
with the Windows properties dialog, and most sites I've seen use that method
when specifying download sizes.
There's more than enough arguing about KiB-MiB/kB-MB in bug 65710 and bug 106618
to suit anyone's needs (especially Ben saying essentially "keep your KiB out of
Firebird" in bug 106618 comment 36): just making 1 MB 1048576 bytes instead of
1024000 and then running away seems best.
(In reply to comment #5)
> just making 1 MB 1048576 bytes instead of 1024000 and then running away seems
> best.

Agreed. This will be affected by the merging of branch and trunk. I'll wait for
that to happen before attaching a patch.
Severity: minor → trivial
Status: NEW → ASSIGNED
OS: Windows XP → All
Priority: -- → P5
Hardware: PC → All
Target Milestone: --- → Firefox1.1
Version: unspecified → Trunk
Attached patch Patch (obsolete) — Splinter Review
Changes the size calculation to correspond with the way Windows and many sites
do it. Also makes files look smaller :).
Attachment #167789 - Flags: review?(bugs)
Attachment #167789 - Flags: review?(bugs) → review?(mconnor)
Attached patch Patch 2 (obsolete) — Splinter Review
D'oh! Don't mess with timer stuff...
Attachment #167789 - Attachment is obsolete: true
Attachment #167910 - Flags: review?(mconnor)
Attachment #167789 - Flags: review?(mconnor)
Comment on attachment 167910 [details] [diff] [review]
Patch 2

diff -up8 please, in the future, provides much more context, and the current
function name for js/c++
Attachment #167910 - Flags: review?(mconnor) → review+
So the filesize will be based on 1024, but the download rate will be based on
1000? Seems strange to me.
Attached patch Patch 3Splinter Review
(In reply to comment #10)
> So the filesize will be based on 1024, but the download rate will be based on

> 1000? Seems strange to me.

Oops.
Attachment #167910 - Attachment is obsolete: true
Comment on attachment 169051 [details] [diff] [review]
Patch 3

Carrying over r=mconnor
Attachment #169051 - Flags: review+
Whiteboard: checkin-needed
Comment on attachment 169051 [details] [diff] [review]
Patch 3

Checking in
mozilla/toolkit/mozapps/downloads/content/DownloadProgressListener.js;
/cvsroot/mozilla/toolkit/mozapps/downloads/content/DownloadProgressListener.js,
v  <--	DownloadProgressListener.js
new revision: 1.7; previous revision: 1.6
done
Whiteboard: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
*** Bug 284487 has been marked as a duplicate of this bug. ***
*** Bug 289743 has been marked as a duplicate of this bug. ***
*** Bug 305594 has been marked as a duplicate of this bug. ***
*** Bug 306408 has been marked as a duplicate of this bug. ***
*** Bug 313336 has been marked as a duplicate of this bug. ***
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: