Skip to content

Commit 89714d4

Browse files
committed
Bump min node/firefox/chrome version to ensure globalThis
This change bumps the minimum versions of these engines so that we no longer need to support engines without `globalThis`.
1 parent a455a08 commit 89714d4

16 files changed

+54
-140
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,10 @@ jobs:
876876
# support in the generated code.
877877
# Keep this in sync with `OLDEST_SUPPORTED_NODE` in `feature_matrix.py`
878878
- install-node-version:
879-
node_version: "10.19.0"
879+
node_version: "12.22.9"
880880
- run-tests:
881-
title: "node (oldest / 10.19.0)"
882-
extra-cflags: "-sMIN_NODE_VERSION=101900"
881+
title: "node (oldest / 12.22.9)"
882+
extra-cflags: "-sMIN_NODE_VERSION=122209"
883883
# We include most but not all of the nodefs and node rawfs tests here.
884884
# test_fs_nodefs_rw, test_fs_nodefs_statvfs, and test_unistd_io_nodefs_bigint fail.
885885
test_targets: "

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ See docs/process.md for more on how version tagging works.
2020

2121
4.0.16 (in development)
2222
-----------------------
23+
- The minimum supported versions of node, chrome and firefox were bumped in
24+
order remove the globalThis polyfill: (#25375)
25+
- node: v10.19.0 -> v12.22.9
26+
- chrome: v70 -> v71
27+
- firefox: v55 -> v65
2328

2429
4.0.15 - 09/17/25
2530
-----------------

site/source/docs/tools_reference/settings_reference.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,7 +2859,7 @@ are desired to work. Pass -sMIN_FIREFOX_VERSION=majorVersion to drop support
28592859
for Firefox versions older than < majorVersion.
28602860
Firefox 79 was released on 2020-07-28.
28612861
MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
2862-
Minimum supported value is 55 which was released on 2017-08-08 (see
2862+
Minimum supported value is 65 which was released on 2019-01-29 (see
28632863
feature_matrix.py)
28642864

28652865
Default value: 79
@@ -2891,13 +2891,13 @@ Default value: 150000
28912891
MIN_CHROME_VERSION
28922892
==================
28932893

2894-
Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=58 to
2895-
drop support for Chrome 57 and older.
2894+
Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=78 to
2895+
drop support for Chrome 77 and older.
28962896
This setting also applies to modern Chromium-based Edge, which shares version
28972897
numbers with Chrome.
28982898
Chrome 85 was released on 2020-08-25.
28992899
MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
2900-
Minimum supported value is 70, which was released on 2018-10-16 (see
2900+
Minimum supported value is 71, which was released on 2018-12-04 (see
29012901
feature_matrix.py).
29022902

29032903
Default value: 85
@@ -2909,10 +2909,9 @@ MIN_NODE_VERSION
29092909

29102910
Specifies minimum node version to target for the generated code. This is
29112911
distinct from the minimum version required run the emscripten compiler.
2912-
This version aligns with the current Ubuuntu TLS 20.04 (Focal).
29132912
Version is encoded in MMmmVV, e.g. 181401 denotes Node 18.14.01.
2914-
Minimum supported value is 101900, which was released 2020-02-05 (see
2915-
feature_matrix.py).
2913+
Minimum supported value is 122209, which was released 2022-01-11 (see
2914+
feature_matrix.py). This version aligns with the Ubuntu TLS 22.04 (Jammy).
29162915

29172916
Default value: 160000
29182917

src/lib/libcore.js

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,45 +1610,10 @@ addToLibrary({
16101610
emscripten_asm_const_async_on_main_thread: (emAsmAddr, sigPtr, argbuf) => runMainThreadEmAsm(emAsmAddr, sigPtr, argbuf, 0),
16111611
#endif
16121612

1613-
$emGlobalThis__internal: true,
1614-
#if SUPPORTS_GLOBALTHIS
1615-
$emGlobalThis: 'globalThis',
1616-
#else
1617-
$getGlobalThis__internal: true,
1618-
$getGlobalThis: () => {
1619-
if (typeof globalThis != 'undefined') {
1620-
return globalThis;
1621-
}
1622-
#if DYNAMIC_EXECUTION
1623-
return new Function('return this')();
1624-
#else
1625-
function testGlobal(obj) {
1626-
// Use __emGlobalThis as a test symbol to see if `obj` is indeed the
1627-
// global object.
1628-
obj['__emGlobalThis'] = obj;
1629-
var success = typeof __emGlobalThis == 'object' && obj['__emGlobalThis'] === obj;
1630-
delete obj['__emGlobalThis'];
1631-
return success;
1632-
}
1633-
if (typeof self != 'undefined' && testGlobal(self)) {
1634-
return self; // This works for both "window" and "self" (Web Workers) global objects
1635-
}
1636-
#if ENVIRONMENT_MAY_BE_NODE
1637-
if (typeof global != 'undefined' && testGlobal(global)) {
1638-
return global;
1639-
}
1640-
#endif
1641-
abort('unable to get global object.');
1642-
#endif // DYNAMIC_EXECUTION
1643-
},
1644-
$emGlobalThis__deps: ['$getGlobalThis'],
1645-
$emGlobalThis: 'getGlobalThis()',
1646-
#endif // SUPPORTS_GLOBALTHIS
1647-
16481613
#if !DECLARE_ASM_MODULE_EXPORTS
16491614
// When DECLARE_ASM_MODULE_EXPORTS is not set we export native symbols
16501615
// at runtime rather than statically in JS code.
1651-
$exportWasmSymbols__deps: ['$asmjsMangle', '$emGlobalThis',
1616+
$exportWasmSymbols__deps: ['$asmjsMangle',
16521617
#if DYNCALLS || !WASM_BIGINT
16531618
, '$dynCalls'
16541619
#endif
@@ -1666,9 +1631,9 @@ addToLibrary({
16661631
// similar DECLARE_ASM_MODULE_EXPORTS = 0 treatment.
16671632
if (typeof exportedSymbol.value === 'undefined') {
16681633
#if MINIMAL_RUNTIME
1669-
emGlobalThis[name] = exportedSymbol;
1634+
globalThis[name] = exportedSymbol;
16701635
#else
1671-
emGlobalThis[name] = Module[name] = exportedSymbol;
1636+
globalThis[name] = Module[name] = exportedSymbol;
16721637
#endif
16731638
}
16741639
}

src/lib/libemval.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ var LibraryEmVal = {
170170
_emval_new_u16string__deps: ['$Emval'],
171171
_emval_new_u16string: (v) => Emval.toHandle(UTF16ToString(v)),
172172

173-
_emval_get_global__deps: ['$Emval', '$getStringOrSymbol', '$emGlobalThis'],
173+
_emval_get_global__deps: ['$Emval', '$getStringOrSymbol'],
174174
_emval_get_global: (name) => {
175175
if (!name) {
176-
return Emval.toHandle(emGlobalThis);
176+
return Emval.toHandle(globalThis);
177177
}
178178
name = getStringOrSymbol(name);
179-
return Emval.toHandle(emGlobalThis[name]);
179+
return Emval.toHandle(globalThis[name]);
180180
},
181181

182182
_emval_get_module_property__deps: ['$getStringOrSymbol', '$Emval'],

src/lib/libhtml5.js

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,6 @@ var LibraryHTML5 = {
236236

237237
fullscreenEnabled() {
238238
return document.fullscreenEnabled
239-
#if MIN_FIREFOX_VERSION <= 63
240-
// Firefox 64 shipped unprefixed form of fullscreenEnabled (https://caniuse.com/#feat=mdn-api_document_fullscreenenabled)
241-
|| document.mozFullScreenEnabled
242-
#endif
243239
#if MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
244240
// Safari 13.0.3 on macOS Catalina 10.15.1 still ships with prefixed webkitFullscreenEnabled.
245241
// TODO: If Safari at some point ships with unprefixed version, update the version check above.
@@ -1072,12 +1068,7 @@ var LibraryHTML5 = {
10721068
#endif
10731069
if (!target) return {{{ cDefs.EMSCRIPTEN_RESULT_UNKNOWN_TARGET }}};
10741070

1075-
#if MIN_FIREFOX_VERSION <= 63 // https://caniuse.com/#feat=mdn-api_element_fullscreenchange_event
1076-
registerFullscreenChangeEventCallback(target, userData, useCapture, callbackfunc, {{{ cDefs.EMSCRIPTEN_EVENT_FULLSCREENCHANGE }}}, "mozfullscreenchange", targetThread);
1077-
#endif
1078-
1079-
#if MIN_CHROME_VERSION < 71 || MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
1080-
// Unprefixed Fullscreen API shipped in Chromium 71 (https://bugs.chromium.org/p/chromium/issues/detail?id=383813)
1071+
#if MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
10811072
// As of Safari 13.0.3 on macOS Catalina 10.15.1 still ships with prefixed webkitfullscreenchange. TODO: revisit this check once Safari ships unprefixed version.
10821073
registerFullscreenChangeEventCallback(target, userData, useCapture, callbackfunc, {{{ cDefs.EMSCRIPTEN_EVENT_FULLSCREENCHANGE }}}, "webkitfullscreenchange", targetThread);
10831074
#endif
@@ -1102,13 +1093,7 @@ var LibraryHTML5 = {
11021093

11031094
if (target.requestFullscreen) {
11041095
target.requestFullscreen();
1105-
#if MIN_FIREFOX_VERSION <= 63 // https://caniuse.com/#feat=fullscreen
1106-
} else if (target.mozRequestFullScreen) {
1107-
target.mozRequestFullScreen();
1108-
} else if (target.mozRequestFullscreen) {
1109-
target.mozRequestFullscreen();
1110-
#endif
1111-
#if MIN_CHROME_VERSION <= 70 || MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
1096+
#if MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
11121097
} else if (target.webkitRequestFullscreen) {
11131098
target.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
11141099
#endif
@@ -1214,12 +1199,7 @@ var LibraryHTML5 = {
12141199
if (!getFullscreenElement()) {
12151200
document.removeEventListener('fullscreenchange', restoreOldStyle);
12161201

1217-
#if MIN_FIREFOX_VERSION <= 63 // https://caniuse.com/#feat=mdn-api_element_fullscreenchange_event
1218-
document.removeEventListener('mozfullscreenchange', restoreOldStyle);
1219-
#endif
1220-
1221-
#if MIN_CHROME_VERSION < 71 || MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
1222-
// Unprefixed Fullscreen API shipped in Chromium 71 (https://bugs.chromium.org/p/chromium/issues/detail?id=383813)
1202+
#if MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
12231203
// As of Safari 13.0.3 on macOS Catalina 10.15.1 still ships with prefixed webkitfullscreenchange. TODO: revisit this check once Safari ships unprefixed version.
12241204
document.removeEventListener('webkitfullscreenchange', restoreOldStyle);
12251205
#endif
@@ -1258,11 +1238,7 @@ var LibraryHTML5 = {
12581238
}
12591239
}
12601240
document.addEventListener('fullscreenchange', restoreOldStyle);
1261-
#if MIN_FIREFOX_VERSION <= 63 // https://caniuse.com/#feat=mdn-api_element_fullscreenchange_event
1262-
document.addEventListener('mozfullscreenchange', restoreOldStyle);
1263-
#endif
1264-
#if MIN_CHROME_VERSION < 71 || MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
1265-
// Unprefixed Fullscreen API shipped in Chromium 71 (https://bugs.chromium.org/p/chromium/issues/detail?id=383813)
1241+
#if MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
12661242
// As of Safari 13.0.3 on macOS Catalina 10.15.1 still ships with prefixed webkitfullscreenchange. TODO: revisit this check once Safari ships unprefixed version.
12671243
document.addEventListener('webkitfullscreenchange', restoreOldStyle);
12681244
#endif
@@ -1377,11 +1353,7 @@ var LibraryHTML5 = {
13771353
if (!target) return {{{ cDefs.EMSCRIPTEN_RESULT_UNKNOWN_TARGET }}};
13781354

13791355
if (!target.requestFullscreen
1380-
#if MIN_FIREFOX_VERSION <= 63 // https://caniuse.com/#feat=fullscreen
1381-
&& !target.mozRequestFullScreen
1382-
&& !target.mozRequestFullscreen
1383-
#endif
1384-
#if MIN_CHROME_VERSION <= 70 || MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
1356+
#if MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED
13851357
&& !target.webkitRequestFullscreen
13861358
#endif
13871359
) {
@@ -1525,10 +1497,6 @@ var LibraryHTML5 = {
15251497
var d = specialHTMLTargets[{{{ cDefs.EMSCRIPTEN_EVENT_TARGET_DOCUMENT }}}];
15261498
if (d.exitFullscreen) {
15271499
d.fullscreenElement && d.exitFullscreen();
1528-
#if MIN_FIREFOX_VERSION < 64 // https://caniuse.com/#feat=mdn-api_document_exitfullscreen
1529-
} else if (d.mozCancelFullScreen) {
1530-
d.mozFullScreenElement && d.mozCancelFullScreen();
1531-
#endif
15321500
#if MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED // https://caniuse.com/#feat=mdn-api_document_exitfullscreen
15331501
} else if (d.webkitExitFullscreen) {
15341502
d.webkitFullscreenElement && d.webkitExitFullscreen();

src/postamble_minimal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ var imports = {
158158

159159
#if MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION
160160
// https://caniuse.com/#feat=wasm and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming
161-
#if MIN_FIREFOX_VERSION < 58 || MIN_SAFARI_VERSION < 150000 || ENVIRONMENT_MAY_BE_NODE
161+
#if MIN_SAFARI_VERSION < 150000 || ENVIRONMENT_MAY_BE_NODE
162162
#if ASSERTIONS && !WASM2JS
163163
// Module['wasm'] should contain a typed array of the Wasm object data, or a
164164
// precompiled WebAssembly Module.

src/preamble.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ async function instantiateArrayBuffer(binaryFile, imports) {
593593
async function instantiateAsync(binary, binaryFile, imports) {
594594
#if !SINGLE_FILE
595595
if (!binary
596-
#if MIN_FIREFOX_VERSION < 58 || MIN_SAFARI_VERSION < 150000
596+
#if MIN_SAFARI_VERSION < 150000
597597
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming
598598
&& WebAssembly.instantiateStreaming
599599
#endif

src/settings.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@ var AUTO_NATIVE_LIBRARIES = true;
18731873
// for Firefox versions older than < majorVersion.
18741874
// Firefox 79 was released on 2020-07-28.
18751875
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
1876-
// Minimum supported value is 55 which was released on 2017-08-08 (see
1876+
// Minimum supported value is 65 which was released on 2019-01-29 (see
18771877
// feature_matrix.py)
18781878
// [link]
18791879
var MIN_FIREFOX_VERSION = 79;
@@ -1895,23 +1895,22 @@ var MIN_FIREFOX_VERSION = 79;
18951895
// [link]
18961896
var MIN_SAFARI_VERSION = 150000;
18971897

1898-
// Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=58 to
1899-
// drop support for Chrome 57 and older.
1898+
// Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=78 to
1899+
// drop support for Chrome 77 and older.
19001900
// This setting also applies to modern Chromium-based Edge, which shares version
19011901
// numbers with Chrome.
19021902
// Chrome 85 was released on 2020-08-25.
19031903
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
1904-
// Minimum supported value is 70, which was released on 2018-10-16 (see
1904+
// Minimum supported value is 71, which was released on 2018-12-04 (see
19051905
// feature_matrix.py).
19061906
// [link]
19071907
var MIN_CHROME_VERSION = 85;
19081908

19091909
// Specifies minimum node version to target for the generated code. This is
19101910
// distinct from the minimum version required run the emscripten compiler.
1911-
// This version aligns with the current Ubuuntu TLS 20.04 (Focal).
19121911
// Version is encoded in MMmmVV, e.g. 181401 denotes Node 18.14.01.
1913-
// Minimum supported value is 101900, which was released 2020-02-05 (see
1914-
// feature_matrix.py).
1912+
// Minimum supported value is 122209, which was released 2022-01-11 (see
1913+
// feature_matrix.py). This version aligns with the Ubuntu TLS 22.04 (Jammy).
19151914
var MIN_NODE_VERSION = 160000;
19161915

19171916
// If true, uses minimal sized runtime without POSIX features, Module,

src/settings_internal.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ var MINIFY_WASM_IMPORTED_MODULES = false;
158158
// Whether to minify exports from the Wasm module.
159159
var MINIFY_WASM_EXPORT_NAMES = true;
160160

161-
// Used to track whether target environment supports the 'globalThis' attribute.
162-
var SUPPORTS_GLOBALTHIS = false;
163-
164161
// Used to track whether target environment supports the 'Promise.any'.
165162
var SUPPORTS_PROMISE_ANY = false;
166163

0 commit comments

Comments
 (0)