Skip to content

[file_packager] Convert fetchRemotePackage to async. NFC #24893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Aug 8, 2025

Part 4 in the sequence following #24882, #24883 and #24885.

@sbc100 sbc100 requested a review from kripken August 8, 2025 21:14
@sbc100 sbc100 changed the title [file_packages] Convert fetchRemotePackage to async. NFC [file_packager] Convert fetchRemotePackage to async. NFC Aug 8, 2025
@sbc100 sbc100 force-pushed the file_packager_async_part4 branch 4 times, most recently from e5efcc8 to 13305e0 Compare August 8, 2025 23:00
@sbc100 sbc100 force-pushed the file_packager_async_part4 branch from 13305e0 to f874811 Compare August 8, 2025 23:16
@sbc100 sbc100 requested review from kripken and lkwinta August 8, 2025 23:38
const iterate = () => reader.read().then(handleChunk).catch((cause) => {
return Promise.reject(new Error(`Unexpected error while handling : ${response.url} ${cause}`, {cause}));
});
const chunks = [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything here and on can be removed nowadays - all browsers we care about support response.arrayBuffer() so it's enough to return just that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, or is the goal to show actual progress? Then perhaps the opposite, remove the polyfill.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the goal is to show progress.

I don't know which polyfill is being referred to above, but its not something emscripten includes.

Maybe it can be remove now? It was added in #22016 but I don't see anything about if/when the polyfill might be used. Probably best to leave that to a separate cleanup PR.

@sbc100 sbc100 force-pushed the file_packager_async_part4 branch from f874811 to 6d48d48 Compare August 9, 2025 14:30
Comment on lines +982 to +984
while (1) {
var {done, value} = await reader.read();
if (done) break;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also do

Suggested change
while (1) {
var {done, value} = await reader.read();
if (done) break;
for await (var value of reader) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a very new JS feature though right? I'll maybe leave that as a followup since its not a feature we currently depend onn

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm relatively new, yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants