Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/library_wasm_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ mergeInto(LibraryManager.library, {
'sb': stackLowestAddress, // sb = stack bottom (lowest stack address, SP points at this when stack is full)
'sz': stackSize, // sz = stack size
});
worker.addEventListener('message', __wasm_worker_runPostMessage);
worker.onmessage = __wasm_worker_runPostMessage;
return _wasm_workers_id++;
},

Expand Down
2 changes: 1 addition & 1 deletion src/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ if (ENVIRONMENT_IS_NODE) {

Module['inspect'] = () => '[Emscripten Module object]';

#if PTHREADS
#if PTHREADS || WASM_WORKERS
let nodeWorkerThreads;
try {
nodeWorkerThreads = require('worker_threads');
Expand Down
2 changes: 1 addition & 1 deletion test/code_size/hello_wasm_worker_wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ WebAssembly.instantiate(b.wasm, {
sb: a,
sz: d
});
r.addEventListener("message", n);
r.onmessage = n;
return k++;
},
c: function() {
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/hello_wasm_worker_wasm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.html": 737,
"a.html.gz": 433,
"a.js": 733,
"a.js.gz": 463,
"a.js": 715,
"a.js.gz": 465,
"a.wasm": 1862,
"a.wasm.gz": 1040,
"total": 3332,
"total_gz": 1936
"total": 3314,
"total_gz": 1938
}
8 changes: 8 additions & 0 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9761,6 +9761,14 @@ def test_emscripten_async_load_script(self):
self.run_process([FILE_PACKAGER, 'test.data', '--preload', 'file1.txt', 'file2.txt', '--from-emcc', '--js-output=script2.js'])
self.do_runf(test_file('test_emscripten_async_load_script.c'), emcc_args=['-sFORCE_FILESYSTEM'])

@node_pthreads
def test_wasm_worker_hello(self):
self.do_runf(test_file('wasm_worker/hello_wasm_worker.c'), emcc_args=['-sWASM_WORKERS'])

@node_pthreads
def test_wasm_worker_malloc(self):
self.do_runf(test_file('wasm_worker/malloc_wasm_worker.c'), emcc_args=['-sWASM_WORKERS'])


# Generate tests for everything
def make_run(name, emcc_args, settings=None, env=None,
Expand Down