Skip to content

Commit 7056eb3

Browse files
authored
Fix use of source maps with sync compilation (#16632)
Fixes: #15036
1 parent 9aaaacf commit 7056eb3

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/preamble.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,13 @@ var splitModuleProxyHandler = {
906906
};
907907
#endif
908908

909+
#if LOAD_SOURCE_MAP
910+
function receiveSourceMapJSON(sourceMap) {
911+
wasmSourceMap = new WasmSourceMap(sourceMap);
912+
{{{ runOnMainThread("removeRunDependency('source-map');") }}}
913+
}
914+
#endif
915+
909916
#if SPLIT_MODULE || !WASM_ASYNC_COMPILATION
910917
function instantiateSync(file, info) {
911918
var instance;
@@ -1116,11 +1123,6 @@ function createWasm() {
11161123

11171124
#if LOAD_SOURCE_MAP
11181125
{{{ runOnMainThread("addRunDependency('source-map');") }}}
1119-
1120-
function receiveSourceMapJSON(sourceMap) {
1121-
wasmSourceMap = new WasmSourceMap(sourceMap);
1122-
{{{ runOnMainThread("removeRunDependency('source-map');") }}}
1123-
}
11241126
#endif
11251127

11261128
// Prefer streaming instantiation if available.

tests/test_other.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9617,6 +9617,14 @@ def test_asan_null_deref(self):
96179617
'AddressSanitizer: null-pointer-dereference on address',
96189618
])
96199619

9620+
def test_asan_sync_compilation(self):
9621+
self.set_setting('WASM_ASYNC_COMPILATION', 0)
9622+
self.do_runf(test_file('other/test_asan_null_deref.c'),
9623+
emcc_args=['-fsanitize=address', '-gsource-map'],
9624+
assert_returncode=NON_ZERO, expected_output=[
9625+
'AddressSanitizer: null-pointer-dereference on address',
9626+
])
9627+
96209628
def test_asan_memory_growth(self):
96219629
self.do_runf(test_file('other/test_asan_null_deref.c'),
96229630
emcc_args=['-fsanitize=address', '-sALLOW_MEMORY_GROWTH'],

0 commit comments

Comments
 (0)