Fix: safari bug downloadspeed#695
Merged
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
|
Looks good 😎 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Safari, the download speed was updating too fast. Moreover, the speed was not readable, and you could see
NaN and undefined.Some pictures before the fix
Same upload on Brave:

From what I gathered:
progressevents very rapidlyDate.now()returns the same value for both, because of 1ms resolutionelapsed = 0-> division by zero -> Infinity -> NaN cascadeBrave/Chrome have sub-millisecond timer resolution, so two events within the same millisecond still return different
Date.now()values, andelapsedis never0.Here is a video of how it looked after the guard.
Screen.Recording.2026-04-26.at.12.16.51.mov
So a "throttle" was necessary, hence the
elapsed < 300Screen.Recording.2026-04-26.at.12.41.16.mov