diff --git a/src/library_pthread.js b/src/library_pthread.js index 09772bc483682..deaf2dac74d15 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -447,17 +447,13 @@ var LibraryPThread = { var p = trustedTypes.createPolicy( 'emscripten#workerPolicy1', { - createScriptURL: (ignored) => new URL("{{{ TARGET_JS_NAME }}}", import.meta.url) + createScriptURL: (ignored) => new URL(import.meta.url) } ); worker = new Worker(p.createScriptURL('ignored'), workerOptions); } else #endif - // We need to generate the URL with import.meta.url as the base URL of the JS file - // instead of just using new URL(import.meta.url) because bundler's only recognize - // the first case in their bundling step. The latter ends up producing an invalid - // URL to import from the server (e.g., for webpack the file:// path). - worker = new Worker(new URL('{{{ TARGET_JS_NAME }}}', import.meta.url), workerOptions); + worker = new Worker(new URL(import.meta.url), workerOptions); #else var pthreadMainJs = currentScript; #if expectToReceiveOnModule('mainScriptUrlOrBlob') diff --git a/test/common.py b/test/common.py index b6a821360304e..ec5d8f484f504 100644 --- a/test/common.py +++ b/test/common.py @@ -1155,7 +1155,7 @@ def add_on_exit(self, code): # libraries, for example def get_emcc_args(self, main_file=False, compile_only=False, asm_only=False): def is_ldflag(f): - return any(f.startswith(s) for s in ['-sEXPORT_ES6', '-sPROXY_TO_PTHREAD', '-sENVIRONMENT=', '--pre-js=', '--post-js=', '-sPTHREAD_POOL_SIZE=']) + return any(f.startswith(s) for s in ['-sEXPORT_ES6', '-sPROXY_TO_PTHREAD', '-sENVIRONMENT=', '--pre-js=', '--post-js=']) args = self.serialize_settings(compile_only or asm_only) + self.emcc_args if asm_only: diff --git a/test/test_browser.py b/test/test_browser.py index ec26dbae6111a..21f58c25b0528 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -5345,13 +5345,13 @@ def test_error_reporting(self): def test_webpack(self, es6): if es6: shutil.copytree(test_file('webpack_es6'), 'webpack') - self.emcc_args += ['-sEXPORT_ES6', '-pthread', '-sPTHREAD_POOL_SIZE=1'] + self.emcc_args += ['-sEXPORT_ES6'] outfile = 'src/hello.mjs' else: shutil.copytree(test_file('webpack'), 'webpack') outfile = 'src/hello.js' with utils.chdir('webpack'): - self.compile_btest('hello_world.c', ['-sEXIT_RUNTIME', '-sMODULARIZE', '-sENVIRONMENT=web,worker', '-o', outfile]) + self.compile_btest('hello_world.c', ['-sEXIT_RUNTIME', '-sMODULARIZE', '-sENVIRONMENT=web', '-o', outfile]) self.run_process(shared.get_npm_cmd('webpack') + ['--mode=development', '--no-devtool']) shutil.copyfile('webpack/src/hello.wasm', 'webpack/dist/hello.wasm') self.run_browser('webpack/dist/index.html', '/report_result?exit:0') diff --git a/test/test_other.py b/test/test_other.py index 99f89139adcd2..4f8b9e1e7ed9d 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -375,7 +375,7 @@ def test_emcc_output_worker_mjs(self, args): test_file('hello_world.c')] + args) src = read_file('subdir/hello_world.mjs') self.assertContained("new URL('hello_world.wasm', import.meta.url)", src) - self.assertContained("new Worker(new URL('hello_world.mjs', import.meta.url), workerOptions)", src) + self.assertContained("new Worker(new URL(import.meta.url), workerOptions)", src) self.assertContained('export default Module;', src) self.assertContained('hello, world!', self.run_js('subdir/hello_world.mjs')) @@ -387,7 +387,7 @@ def test_emcc_output_worker_mjs_single_file(self): test_file('hello_world.c'), '-sSINGLE_FILE']) src = read_file('hello_world.mjs') self.assertNotContained("new URL('data:", src) - self.assertContained("new Worker(new URL('hello_world.mjs', import.meta.url), workerOptions)", src) + self.assertContained("new Worker(new URL(import.meta.url), workerOptions)", src) self.assertContained('hello, world!', self.run_js('hello_world.mjs')) def test_emcc_output_mjs_closure(self):