Open Bug 1975797 Opened 9 months ago Updated 8 months ago

Throttled download progress only updates if another byte arrives

Categories

(Toolkit :: Downloads API, defect, P3)

defect

Tracking

()

ASSIGNED

People

(Reporter: dmcintosh, Assigned: dmcintosh)

Details

Attachments

(2 files)

Attached file bugserv.py

When downloading a file, Firefox doesn't update the progress if it was less than 400ms since the last update. However, if no more bytes arrive for a while afterwards, Firefox can be left displaying an incorrect progress measure.

For example, I can try running the attached Python script (I'm on Windows 11 24H2). It sends 4KiB immediately, then ~80KiB after that. I would expect that Firefox updates to 84KiB at some point before finishing the download, but instead it appears to go instantaneously from 4KiB to 84KiB as it finishes.

I found this while writing a new set of tests for my DownloadsTaskbar changes; they wait for the progress to update, but that doesn't happen! It isn't really a problem for general use, unless your connection cuts out for a good few seconds.

I'll attach a Phabricator patch that appears to fix it; I suspect it internally needs work, as well as needing tests, but it does appear to fix the problem.

[Aside: could it make sense to reduce the timeout from 400ms to e.g. 200ms? I don't think updating the progress is that CPU-intensive, and it might look a bit smoother, but it's also not that important how long it is.]

The severity field is not set for this bug.
:mak, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(mak)

I think this is a valid idea, the code could be simplified by just calling again _SetBytes with the same arguments, the patch seems to do a bit more (e.g. hasPartialData was already set, it may not be necessary to use a repeating timer, since _setBytes will likely be invoked again and it can see there's already a timer and let it be...)

Updating the progress indicator is expensive when there's lots of windows.

Severity: -- → S3
Flags: needinfo?(mak)
Priority: -- → P3
Assignee: nobody → dmcintosh
Attachment #9498681 - Attachment description: WIP: Bug 1975797 - Add a timer to ensure download progress updates eventually. → Bug 1975797 - Ensure download progress updates eventually by using a timer. r=mak
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: