@@ -808,10 +808,12 @@ function instantiateSync(file, info) {
808
808
}
809
809
#endif
810
810
811
- #if expectToReceiveOnModule ( 'instantiateWasm' ) && ( LOAD_SOURCE_MAP || USE_OFFSET_CONVERTER )
812
- // When using postMessage to send an object, it is processed by the structured clone algorithm.
813
- // The prototype, and hence methods, on that object is then lost. This function adds back the lost prototype.
814
- // This does not work with nested objects that has prototypes, but it suffices for WasmSourceMap and WasmOffsetConverter.
811
+ #if PTHREADS && ( LOAD_SOURCE_MAP || USE_OFFSET_CONVERTER )
812
+ // When using postMessage to send an object, it is processed by the structured
813
+ // clone algorithm. The prototype, and hence methods, on that object is then
814
+ // lost. This function adds back the lost prototype. This does not work with
815
+ // nested objects that has prototypes, but it suffices for WasmSourceMap and
816
+ // WasmOffsetConverter.
815
817
function resetPrototype ( constructor , attrs ) {
816
818
var object = Object . create ( constructor . prototype ) ;
817
819
return Object . assign ( object , attrs ) ;
@@ -1093,26 +1095,31 @@ function createWasm() {
1093
1095
1094
1096
#if expectToReceiveOnModule ( 'instantiateWasm' )
1095
1097
// User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
1096
- // to manually instantiate the Wasm module themselves. This allows pages to run the instantiation parallel
1097
- // to any other async startup actions they are performing.
1098
- // Also pthreads and wasm workers initialize the wasm instance through this path.
1098
+ // to manually instantiate the Wasm module themselves. This allows pages to
1099
+ // run the instantiation parallel to any other async startup actions they are
1100
+ // performing.
1101
+ // Also pthreads and wasm workers initialize the wasm instance through this
1102
+ // path.
1099
1103
if ( Module [ 'instantiateWasm' ] ) {
1100
- #if USE_OFFSET_CONVERTER
1101
- #if ASSERTIONS && PTHREADS
1104
+
1105
+ #if USE_OFFSET_CONVERTER && PTHREADS
1102
1106
if ( ENVIRONMENT_IS_PTHREAD ) {
1107
+ #if ASSERTIONS
1103
1108
assert ( Module [ 'wasmOffsetData' ] , 'wasmOffsetData not found on Module object' ) ;
1104
- }
1105
1109
#endif
1106
- wasmOffsetConverter = resetPrototype ( WasmOffsetConverter , Module [ 'wasmOffsetData' ] ) ;
1110
+ wasmOffsetConverter = resetPrototype ( WasmOffsetConverter , Module [ 'wasmOffsetData' ] ) ;
1111
+ }
1107
1112
#endif
1108
- #if LOAD_SOURCE_MAP
1109
- #if ASSERTIONS && PTHREADS
1113
+
1114
+ #if LOAD_SOURCE_MAP && PTHREADS
1110
1115
if ( ENVIRONMENT_IS_PTHREAD ) {
1116
+ #if ASSERTIONS
1111
1117
assert ( Module [ 'wasmSourceMapData' ] , 'wasmSourceMapData not found on Module object' ) ;
1112
- }
1113
1118
#endif
1114
- wasmSourceMap = resetPrototype ( WasmSourceMap , Module [ 'wasmSourceMapData' ] ) ;
1119
+ wasmSourceMap = resetPrototype ( WasmSourceMap , Module [ 'wasmSourceMapData' ] ) ;
1120
+ }
1115
1121
#endif
1122
+
1116
1123
try {
1117
1124
return Module [ 'instantiateWasm' ] ( info , receiveInstance ) ;
1118
1125
} catch ( e ) {
0 commit comments