From a756ff0bd47e3acc364c2d221056e67ea8cfebf4 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 20 Sep 2024 12:09:17 -0700 Subject: [PATCH] Stop generating empty `.worker.js` in pthreads builds (#22598) We stopped using a separate worker file back in #21701. That was released in 3.1.58 back in April. This change ends the transition period by no longer generating a dummy/useless worker.js file alongside the output. --- ChangeLog.md | 2 ++ test/test_browser.py | 2 +- test/test_other.py | 16 ---------------- tools/link.py | 9 --------- 4 files changed, 3 insertions(+), 26 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index e06c9815795ca..b8616eece19ef 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -20,6 +20,8 @@ See docs/process.md for more on how version tagging works. 3.1.68 (in development) ----------------------- +- Pthread-based programs no longer generates `.worker.js` file. This file was + made redundant back in 3.1.58 and now is completely removed. (#22598) - The freetype port was updated from v2.6 to v2.13.3. (#22585) - The number of arguments passed to Embind function calls is now only verified with ASSERTIONS enabled. (#22591) diff --git a/test/test_browser.py b/test/test_browser.py index 8455a36dde404..5a3c4919eb542 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -3697,7 +3697,7 @@ def test_pthread_create(self, args): if '-sSINGLE_FILE' in args: self.assertEqual(len(files), 1, files) else: - self.assertEqual(len(files), 4, files) + self.assertEqual(len(files), 3, files) # Test that preallocating worker threads work. def test_pthread_preallocates_workers(self): diff --git a/test/test_other.py b/test/test_other.py index 4e01eb5fa2b66..c568b563ba8ed 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -439,11 +439,6 @@ def test_export_es6(self, args, package_json): Hello(); ''') - if package_json: - # This makes node load all files in the directory as ES6 modules, - # including the worker.js file. - create_file('package.json', '{"type":"module"}') - self.assertContained('hello, world!', self.run_js('runner.mjs')) def test_emcc_out_file(self): @@ -14881,20 +14876,9 @@ def test_embind_no_duplicate_symbols(self): create_file('b.cpp', '#include ') self.run_process([EMXX, '-std=c++23', '-lembind', 'a.cpp', 'b.cpp']) - def test_legacy_pthread_worker_js(self): - self.do_runf('hello_world.c', emcc_args=['-pthread', '-sSTRICT']) - self.assertNotExists('hello_world.worker.js') - self.do_runf('hello_world.c', emcc_args=['-pthread']) - self.assertExists('hello_world.worker.js') - os.mkdir('out') - self.do_runf('hello_world.c', output_basename='out/foo', emcc_args=['-pthread']) - self.assertExists('out/foo.js') - self.assertExists('out/foo.worker.js') - def test_no_pthread(self): self.do_runf('hello_world.c', emcc_args=['-pthread', '-no-pthread']) self.assertExists('hello_world.js') - self.assertNotExists('hello_world.worker.js') self.assertNotContained('Worker', read_file('hello_world.js')) def test_sysroot_includes_first(self): diff --git a/tools/link.py b/tools/link.py index 9e0f9c55d9623..84c0c66c88e24 100644 --- a/tools/link.py +++ b/tools/link.py @@ -2073,15 +2073,6 @@ def phase_final_emitting(options, state, target, wasm_target): return target_dir = os.path.dirname(os.path.abspath(target)) - if settings.PTHREADS and not settings.STRICT and not settings.SINGLE_FILE: - worker_file = shared.replace_suffix(target, get_worker_js_suffix()) - write_file(worker_file, '''\ -// This file is no longer used by emscripten and has been created as a placeholder -// to allow build systems to transition away from depending on it. -// -// Future versions of emscripten will likely stop generating this file at all. -throw new Error('Dummy worker.js file should never be used'); -''') # Deploy the Wasm Worker bootstrap file as an output file (*.ww.js) if settings.WASM_WORKERS == 1: