Closed Bug 899122 Opened 11 years ago Closed 11 years ago

Include previously downloaded data in progress reports when restarting

Categories

(Toolkit :: Downloads API, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: Paolo, Assigned: Paolo)

References

Details

Attachments

(1 file)

When a download is restarted from where it stopped, progress reports should
include the bytes that were already downloaded. This provides a more intuitive
behavior to the progress bar in the user interface.
Attached patch The patchSplinter Review
The setSha256Hash fix is unrelated, but it fixed an issue I encountered while
testing this patch in the user interface.
Assignee: nobody → paolo.mozmail
Status: NEW → ASSIGNED
Attachment #783719 - Flags: review?(enndeakin)
Comment on attachment 783719 [details] [diff] [review]
The patch

>+  // Continue when the number of bytes we received is correct, then check that
>+  // progress is at about 75 percent (while the exact figure may vary).
>+  yield deferMidway.promise;
>+  do_check_true(download.progress > 72 && download.progress < 78);

Why isn't this exactly 75%?
(In reply to Neil Deakin from comment #2)
> Why isn't this exactly 75%?

We have rounding issues because the total number of bytes in the request isn't a
multiple of four. I can clarify the comment.
Updated to:

  // Continue when the number of bytes we received is correct, then check that
  // progress is at about 75 percent.  The exact figure may vary because of
  // rounding issues, since the total number of bytes in the response might not
  // be a multiple of four.
Attachment #783719 - Flags: review?(enndeakin) → review+
https://hg.mozilla.org/mozilla-central/rev/ff1477ebf69e
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: