Skip to content

Commit cdf6095

Browse files
committed
cleanup
1 parent a2d1d18 commit cdf6095

4 files changed

+6
-10
lines changed

src/preamble.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ async function getWasmBinary(binaryFile) {
657657
) {
658658
// Fetch the binary using readAsync
659659
try {
660-
/** @type{!ArrayBuffer} */
661660
var response = await readAsync(binaryFile);
662661
return new Uint8Array(response);
663662
} catch {
@@ -845,7 +844,7 @@ async function instantiateAsync(binary, binaryFile, imports) {
845844
// "response was already consumed" error.)
846845
var clonedResponse = (await response).clone();
847846
#endif
848-
var result = WebAssembly.instantiateStreaming(response, imports);
847+
var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
849848
#if USE_OFFSET_CONVERTER
850849
// When using the offset converter, we must interpose here. First,
851850
// the instantiation result must arrive (if it fails, the error
@@ -854,17 +853,14 @@ async function instantiateAsync(binary, binaryFile, imports) {
854853
// call receiveInstantiationResult, as that function will use the
855854
// offset converter (in the case of pthreads, it will create the
856855
// pthreads and send them the offsets along with the wasm instance).
857-
var instantiationResult = await result;
858856
var arrayBufferResult = await clonedResponse.arrayBuffer();
859857
try {
860858
wasmOffsetConverter = new WasmOffsetConverter(new Uint8Array(arrayBufferResult), instantiationResult.module);
861859
} catch (reason) {
862860
err(`failed to initialize offset-converter: ${reason}`);
863861
}
864-
return instantiationResult;
865-
#else
866-
return await result;
867862
#endif
863+
return instantiationResult;
868864
} catch (reason) {
869865
// We expect the most common failure cause to be a bad MIME type for the binary,
870866
// in which case falling back to ArrayBuffer instantiation should work.
@@ -1098,7 +1094,7 @@ function getWasmImports() {
10981094
} catch (e) {
10991095
// If instantiation fails, reject the module ready promise.
11001096
readyPromiseReject(e);
1101-
throw e;
1097+
return;
11021098
}
11031099
#endif
11041100
#else // WASM_ASYNC_COMPILATION
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
54928
1+
54390
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
30416
1+
29886
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
53724
1+
53186

0 commit comments

Comments
 (0)