Skip to content

Commit ffb8149

Browse files
committed
Ensure compatibility with Safari for multi-environment ES6 builds
Use a different parameter name to prevent the variable from being incorrectly hoisted in JavaScriptCore-based engines (such as Safari). See: https://bugs.webkit.org/show_bug.cgi?id=223533. Regressed for multi-environment ES6 builds since commit ce4c405 (Emscripten 3.1.27). `-sENVIRONMENT=web` is not affected, as that would avoid the emit of this async function altogether. Resolves: #18357.
1 parent 785bdd9 commit ffb8149

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

emcc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3767,9 +3767,10 @@ def modularize():
37673767
if not settings.EXPORT_READY_PROMISE:
37683768
return_value = '{}'
37693769

3770+
# FIXME: https://bugs.webkit.org/show_bug.cgi?id=223533
37703771
src = '''
3771-
%(maybe_async)sfunction(%(EXPORT_NAME)s) {
3772-
%(EXPORT_NAME)s = %(EXPORT_NAME)s || {};
3772+
%(maybe_async)sfunction(_%(EXPORT_NAME)s) {
3773+
%(EXPORT_NAME)s = _%(EXPORT_NAME)s || {};
37733774
37743775
%(src)s
37753776

0 commit comments

Comments
 (0)