Skip to content

[wasmfs] FetchFS: Remove unnecessary Promise.resolve() calls. NFC #24443

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

Merged
merged 1 commit into from
Jul 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/lib/libwasmfs_fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ addToLibrary({
chunks: [wholeFileData],
chunkSize: wholeFileData.byteLength
};
return Promise.resolve();
return;
}
}
var firstChunk = (offset / chunkSize) | 0;
Expand All @@ -84,7 +84,7 @@ addToLibrary({
if (allPresent) {
// The data is already here, so nothing to do before we continue on to
// the actual read.
return Promise.resolve();
return;
}
// This is the first time we want the chunks' data. We'll make
// one request for all the chunks we need, rather than one
Expand All @@ -100,20 +100,15 @@ addToLibrary({
for (i = firstChunk; i <= lastChunk; i++) {
wasmFS$JSMemoryRanges[file].chunks[i] = bytes.slice(i*chunkSize-start,(i+1)*chunkSize-start);
}
return Promise.resolve();
}

wasmFS$backends[backend] = {
// alloc/free operations are not actually async. Just forward to the
// parent class, but we must return a Promise as the caller expects.
allocFile: async (file) => {
// nop
return Promise.resolve();
},
allocFile: async (file) => { /* nop */ },
freeFile: async (file) => {
// free memory
wasmFS$JSMemoryRanges[file] = undefined;
return Promise.resolve();
},

write: async (file, buffer, length, offset) => {
Expand Down