@@ -657,7 +657,6 @@ async function getWasmBinary(binaryFile) {
657
657
) {
658
658
// Fetch the binary using readAsync
659
659
try {
660
- /** @type {!ArrayBuffer } */
661
660
var response = await readAsync ( binaryFile ) ;
662
661
return new Uint8Array ( response ) ;
663
662
} catch {
@@ -845,7 +844,7 @@ async function instantiateAsync(binary, binaryFile, imports) {
845
844
// "response was already consumed" error.)
846
845
var clonedResponse = ( await response ) . clone ( ) ;
847
846
#endif
848
- var result = WebAssembly . instantiateStreaming ( response , imports ) ;
847
+ var instantiationResult = await WebAssembly . instantiateStreaming ( response , imports ) ;
849
848
#if USE_OFFSET_CONVERTER
850
849
// When using the offset converter, we must interpose here. First,
851
850
// the instantiation result must arrive (if it fails, the error
@@ -854,17 +853,14 @@ async function instantiateAsync(binary, binaryFile, imports) {
854
853
// call receiveInstantiationResult, as that function will use the
855
854
// offset converter (in the case of pthreads, it will create the
856
855
// pthreads and send them the offsets along with the wasm instance).
857
- var instantiationResult = await result ;
858
856
var arrayBufferResult = await clonedResponse . arrayBuffer ( ) ;
859
857
try {
860
858
wasmOffsetConverter = new WasmOffsetConverter ( new Uint8Array ( arrayBufferResult ) , instantiationResult . module ) ;
861
859
} catch ( reason ) {
862
860
err ( `failed to initialize offset-converter: ${ reason } ` ) ;
863
861
}
864
- return instantiationResult ;
865
- #else
866
- return await result ;
867
862
#endif
863
+ return instantiationResult ;
868
864
} catch ( reason ) {
869
865
// We expect the most common failure cause to be a bad MIME type for the binary,
870
866
// in which case falling back to ArrayBuffer instantiation should work.
@@ -1098,7 +1094,7 @@ function getWasmImports() {
1098
1094
} catch ( e ) {
1099
1095
// If instantiation fails, reject the module ready promise.
1100
1096
readyPromiseReject ( e ) ;
1101
- throw e ;
1097
+ return ;
1102
1098
}
1103
1099
#endif
1104
1100
#else // WASM_ASYNC_COMPILATION
0 commit comments