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
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ See docs/process.md for more on how version tagging works.
- If exceptions are disabled, using `new` together with `std::nothrow` no
longer aborts if the allocation fails. Instead `nullptr` is returned now.
This does not change the behavior of regular usage of `new`.
- Default `MIN_CHROME_VERSION` was increased from 75 to 85 and default
`MIN_FIREFOX_VERSION` was increased from 68 to 79 to allow Emscripten
to use some ES2021 features for smaller JavaScript code size. (#20549)

3.1.47 - 10/09/23
-----------------
Expand Down
8 changes: 4 additions & 4 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1768,10 +1768,10 @@ var AUTO_NATIVE_LIBRARIES = true;
// versions >= MIN_FIREFOX_VERSION
// are desired to work. Pass -sMIN_FIREFOX_VERSION=majorVersion to drop support
// for Firefox versions older than < majorVersion.
// Firefox ESR 68 was released on July 9, 2019.
// Firefox 79 was released on 2020-07-28.
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
// [link]
var MIN_FIREFOX_VERSION = 68;
var MIN_FIREFOX_VERSION = 79;

// Specifies the oldest version of desktop Safari to target. Version is encoded
// in MMmmVV, e.g. 70101 denotes Safari 7.1.1.
Expand Down Expand Up @@ -1810,10 +1810,10 @@ var MIN_EDGE_VERSION = 0x7FFFFFFF;

// Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=58 to
// drop support for Chrome 57 and older.
// Chrome 75.0.3770 was released on 2019-06-04
// Chrome 85 was released on 2020-08-25.
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
// [link]
var MIN_CHROME_VERSION = 75;
var MIN_CHROME_VERSION = 85;

// Specifies minimum node version to target for the generated code. This is
// distinct from the minimum version required run the emscripten compiler.
Expand Down
8 changes: 2 additions & 6 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9907,13 +9907,9 @@ def test_main_reads_args(self):
@requires_node
def test_promise(self):
# This test depends on Promise.any, which in turn requires a modern target. Check that it
# fails to even build without bumping the min versions:
err = self.expect_fail([EMCC, test_file('core/test_promise.c')])
# fails to even build on old targets.
err = self.expect_fail([EMCC, test_file('core/test_promise.c'), '-sMIN_CHROME_VERSION=75'])
self.assertContained('error: emscripten_promise_any used, but Promise.any is not supported by the current runtime configuration', err)
self.set_setting('MIN_NODE_VERSION', '150000')
self.set_setting('MIN_SAFARI_VERSION', '150000')
self.set_setting('MIN_FIREFOX_VERSION', '79')
self.set_setting('MIN_CHROME_VERSION', '85')
self.do_core_test('test_promise.c')

@with_asyncify_and_jspi
Expand Down
29 changes: 28 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -12967,14 +12967,16 @@ def test_es5_transpile(self, args):
# - arrow funcs
# - for..of
# - object.assign
# - nullish coalescing & chaining
# - logical assignment
create_file('es6_library.js', '''\
addToLibrary({
foo: function(arg="hello") {
// Object.assign + let
let obj = Object.assign({}, {prop:1});
err('prop: ' + obj.prop);

// arror funcs + const
// arrow funcs + const
const bar = () => 2;
err('bar: ' + bar());

Expand All @@ -12991,6 +12993,22 @@ def test_es5_transpile(self, args):
};
global['foo'] = obj3;
err('value2: ' + obj3.myMethod());

// Nullish coalescing
var definitely = global['maybe'] ?? {};

// Optional chaining
global['maybe']
?.subObj
?.[key]
?.func
?.();

// Logical assignment
var obj4 = null;
obj4 ??= 0;
obj4 ||= 1;
obj4 &&= 2;
}
});
''')
Expand All @@ -13005,13 +13023,22 @@ def check_for_es6(filename, expect):
self.assertContained(['() => 2', '()=>2'], js)
self.assertContained('const ', js)
self.assertContained('let ', js)
self.assertContained('?.[', js)
self.assertContained('?.(', js)
self.assertContained('??=', js)
self.assertContained('||=', js)
self.assertContained('&&=', js)
else:
self.verify_es5(filename)
self.assertNotContained('foo(arg=', js)
self.assertNotContained('() => 2', js)
self.assertNotContained('()=>2', js)
self.assertNotContained('const ', js)
self.assertNotContained('let ', js)
self.assertNotContained('??', js)
self.assertNotContained('?.', js)
self.assertNotContained('||=', js)
self.assertNotContained('&&=', js)

# Check that under normal circumstances none of these features get
# removed / transpiled.
Expand Down
4 changes: 2 additions & 2 deletions tools/acorn-optimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ function applyDCEGraphRemovals(ast) {

// Need a parser to pass to acorn.Node constructor.
// Create it once and reuse it.
const stubParser = new acorn.Parser({ecmaVersion: 2020});
const stubParser = new acorn.Parser({ecmaVersion: 2021});

function createNode(props) {
const node = new acorn.Node(stubParser);
Expand Down Expand Up @@ -2008,7 +2008,7 @@ let ast;
try {
ast = acorn.parse(input, {
// Keep in sync with --language_in that we pass to closure in building.py
ecmaVersion: 2020,
ecmaVersion: 2021,
preserveParens: closureFriendly,
onComment: closureFriendly ? sourceComments : undefined,
sourceType: exportES6 ? 'module' : 'script',
Expand Down
2 changes: 1 addition & 1 deletion tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ def closure_compiler(filename, advanced=True, extra_closure_args=None):

args = ['--compilation_level', 'ADVANCED_OPTIMIZATIONS' if advanced else 'SIMPLE_OPTIMIZATIONS']
# Keep in sync with ecmaVersion in tools/acorn-optimizer.js
args += ['--language_in', 'ECMASCRIPT_2020']
args += ['--language_in', 'ECMASCRIPT_2021']
# Tell closure not to do any transpiling or inject any polyfills.
# At some point we may want to look into using this as way to convert to ES5 but
# babel is perhaps a better tool for that.
Expand Down
2 changes: 1 addition & 1 deletion tools/unsafe_optimizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function optPassMergeVarInitializationAssignments(ast) {
}

function runOnJsText(js, pretty = false) {
const ast = acorn.parse(js, {ecmaVersion: 2020});
const ast = acorn.parse(js, {ecmaVersion: 2021});

optPassSimplifyModuleInitialization(ast);
optPassRemoveRedundantOperatorNews(ast);
Expand Down