Skip to content

Commit d8a6db2

Browse files
authored
[wasmfs] FetchFS: Remove unnecessary Promise.resolve() calls. NFC (#24443)
1 parent 25c1806 commit d8a6db2

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/lib/libwasmfs_fetch.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ addToLibrary({
6565
chunks: [wholeFileData],
6666
chunkSize: wholeFileData.byteLength
6767
};
68-
return Promise.resolve();
68+
return;
6969
}
7070
}
7171
var firstChunk = (offset / chunkSize) | 0;
@@ -84,7 +84,7 @@ addToLibrary({
8484
if (allPresent) {
8585
// The data is already here, so nothing to do before we continue on to
8686
// the actual read.
87-
return Promise.resolve();
87+
return;
8888
}
8989
// This is the first time we want the chunks' data. We'll make
9090
// one request for all the chunks we need, rather than one
@@ -100,20 +100,15 @@ addToLibrary({
100100
for (i = firstChunk; i <= lastChunk; i++) {
101101
wasmFS$JSMemoryRanges[file].chunks[i] = bytes.slice(i*chunkSize-start,(i+1)*chunkSize-start);
102102
}
103-
return Promise.resolve();
104103
}
105104

106105
wasmFS$backends[backend] = {
107106
// alloc/free operations are not actually async. Just forward to the
108107
// parent class, but we must return a Promise as the caller expects.
109-
allocFile: async (file) => {
110-
// nop
111-
return Promise.resolve();
112-
},
108+
allocFile: async (file) => { /* nop */ },
113109
freeFile: async (file) => {
114110
// free memory
115111
wasmFS$JSMemoryRanges[file] = undefined;
116-
return Promise.resolve();
117112
},
118113

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

0 commit comments

Comments
 (0)