diff --git a/src/preamble.js b/src/preamble.js index 042bb0e9c80f1..9c7baffb7c0fa 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -1120,6 +1120,24 @@ function createWasm() { var exports = Module['instantiateWasm'](info, receiveInstance); #if ASYNCIFY exports = Asyncify.instrumentWasmExports(exports); +#endif +#if USE_OFFSET_CONVERTER + {{{ + runOnMainThread(` + // We have no way to create an OffsetConverter in this code path since + // we have no access to the wasm binary (only the user does). Instead, + // create a fake one that reports we cannot identify functions from + // their binary offsets. + // Note that we only do this on the main thread, as the workers + // receive the OffsetConverter data from there. + wasmOffsetConverter = { + getName: function() { + return 'unknown-due-to-instantiateWasm'; + } + }; + removeRunDependency('offset-converter'); + `) + }}} #endif return exports; } catch(e) { diff --git a/tests/test_browser.py b/tests/test_browser.py index bbdf840469ee1..555ea8bc3a50f 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -4155,8 +4155,12 @@ def test_binaryen_async(self): self.btest_exit('binaryen_async.c', expected=1, args=common_args) # Test that implementing Module.instantiateWasm() callback works. - def test_manual_wasm_instantiate(self): - self.compile_btest([path_from_root('tests/manual_wasm_instantiate.cpp'), '-o', 'manual_wasm_instantiate.js', '-s', 'BINARYEN']) + @parameterized({ + '': ([],), + 'asan': (['-fsanitize=address', '-s', 'INITIAL_MEMORY=128MB'],) + }) + def test_manual_wasm_instantiate(self, args=[]): + self.compile_btest([path_from_root('tests/manual_wasm_instantiate.cpp'), '-o', 'manual_wasm_instantiate.js'] + args) shutil.copyfile(path_from_root('tests', 'manual_wasm_instantiate.html'), 'manual_wasm_instantiate.html') self.run_browser('manual_wasm_instantiate.html', 'wasm instantiation succeeded', '/report_result?1')