Require yes/no from user if wasm downloading > 10 MB of data#156
Open
ianthomas23 wants to merge 3 commits into
Open
Require yes/no from user if wasm downloading > 10 MB of data#156ianthomas23 wants to merge 3 commits into
ianthomas23 wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #156 +/- ##
=======================================
Coverage 88.52% 88.52%
=======================================
Files 62 62
Lines 2884 2884
Branches 358 358
=======================================
Hits 2553 2553
Misses 331 331 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0e5aaa4 to
f2ef4fb
Compare
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.
This adds a check for wasm http(s) requests on the size of the download. If it exceeds 10 MB, a prompt is displayed to the user to continue or not. For example:
Note the line `Download size is 69.3 MB, continue [y/N]?
The idea is prompt the user to specifically OK a download that will consume a significant amount of browser storage. Note the filesystem usage here is 18 MB for a download of 69 MB, and we cannot advise on what the filesystem usage will be in advance.
Currently the 10 MB is hardcoded. It could be a separate env var I suppose, but we already have quite a few and should maybe avoid adding more unless we really have to. This does at least provide a starting point for future richer behaviour if we wish.
This includes a bit of a refactor of the
wasm_http_responseclass. Now we have a singleresponseperstream(i.e. per http(s) request) and a newread_bufferstruct which is no longer part of theresponsebut is used once perreadcall, which aligns better with howlibgit2behaves. This allows us to easily read the download size and headers just once, and we obtain a slight speedup for downloads with multiple reads as a result.