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
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ See docs/process.md for more on how version tagging works.
- Firefox: v65 -> v68
- For windows users, colored console output for error messages and logging now
requires Windows 10 or above. (#25502)
- Fixed an issue from previous release 4.0.16 where "-sENVIRONMENT=worker" was
erroneously made to imply "-sENVIRONMENT=web,worker" (#25514)
- Passing '-sENVIRONMENT=worker' is now disallowed due to being ambiguous in
its meaning. Instead, use '-sENVIRONMENT=web,worker' or
'-sENVIRONMENT=node,worker' to refer to either Web or Node.js multithreading.

4.0.16 - 10/07/25
-----------------
Expand Down
9 changes: 9 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -14392,6 +14392,15 @@ def test_double_disable_environment(self):
self.run_process([EMCC, test_file('hello_world.c'), '-Werror', '-sENVIRONMENT=node', '-sMIN_CHROME_VERSION=-1'])
self.run_process([EMCC, test_file('hello_world.c'), '-Werror', '-sENVIRONMENT=node', '-sMIN_SAFARI_VERSION=-1'])

# Test that passing "-sENVIRONMENT=node -pthread" will generate code that only targets Node.js multithreading, and
# does not pull in code that supports browser multithreading.
def test_only_target_node_pthreads(self):
self.run_process([EMCC, test_file('hello_world.c'), '-Werror', '-sENVIRONMENT=node', '-pthread'])
content = read_file('a.out.js')
self.assertContained('This page was compiled without support for Safari browser', content)
self.assertContained('This page was compiled without support for Firefox browser', content)
self.assertContained('This page was compiled without support for Chrome browser', content)

def test_signext_lowering(self):
# Use `-v` to show the sub-commands being run by emcc.
cmd = [EMCC, test_file('other/test_signext_lowering.c'), '-v']
Expand Down
8 changes: 5 additions & 3 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,16 @@ def setup_environment_settings():
# The worker environment is automatically added if any of the pthread or Worker features are used.
# Note: we need to actually modify ENVIRONMENTS variable here before the parsing,
# because some JS code reads it back so modifying parsed info alone is not sufficient.
maybe_web_worker = not settings.ENVIRONMENT or 'worker' in settings.ENVIRONMENT

if settings.SHARED_MEMORY and settings.ENVIRONMENT:
settings.ENVIRONMENT.append('worker')

# Environment setting based on user input
if any(x for x in settings.ENVIRONMENT if x not in VALID_ENVIRONMENTS):
exit_with_error(f'Invalid environment specified in "ENVIRONMENT": {settings.ENVIRONMENT}. Should be one of: {",".join(VALID_ENVIRONMENTS)}')

settings.ENVIRONMENT_MAY_BE_WEB = not settings.ENVIRONMENT or 'web' in settings.ENVIRONMENT or 'worker' in settings.ENVIRONMENT
settings.ENVIRONMENT_MAY_BE_WEB = not settings.ENVIRONMENT or 'web' in settings.ENVIRONMENT
settings.ENVIRONMENT_MAY_BE_WEBVIEW = not settings.ENVIRONMENT or 'webview' in settings.ENVIRONMENT
settings.ENVIRONMENT_MAY_BE_NODE = not settings.ENVIRONMENT or 'node' in settings.ENVIRONMENT
settings.ENVIRONMENT_MAY_BE_SHELL = not settings.ENVIRONMENT or 'shell' in settings.ENVIRONMENT
Expand All @@ -183,11 +185,11 @@ def setup_environment_settings():
diagnostics.warning('unused-command-line-argument', 'ignoring MIN_NODE_VERSION because `node` environment is not enabled')
settings.MIN_NODE_VERSION = feature_matrix.UNSUPPORTED

if not (settings.ENVIRONMENT_MAY_BE_WEB or settings.ENVIRONMENT_MAY_BE_WEBVIEW):
if not (settings.ENVIRONMENT_MAY_BE_WEB or maybe_web_worker or settings.ENVIRONMENT_MAY_BE_WEBVIEW):
for browser in ('FIREFOX', 'SAFARI', 'CHROME'):
key = f'MIN_{browser}_VERSION'
if key in user_settings and settings[key] != feature_matrix.UNSUPPORTED:
diagnostics.warning('unused-command-line-argument', 'ignoring %s because `web` and `webview` environments are not enabled', key)
diagnostics.warning('unused-command-line-argument', 'ignoring %s because `web`, `worker` and `webview` environments are not enabled', key)
settings[key] = feature_matrix.UNSUPPORTED


Expand Down