You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user/NashornMigrationGuide.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,10 @@ This is the case for Nashorn-specific extensions that GraalVM JavaScript does no
35
35
Note that you have to enable [experimental options](Options.md#stable-and-experimental-options) to use this flag.
36
36
Further note that setting this flag defeats the [secure by default](#secure-by-default) approach of GraalVM JavaScript in some cases, e.g., when operating on a legacy `ScriptEngine`.
37
37
38
+
When you use the Nashorn compatibility mode, by default, ECMAScript 5 is set as compatibility level.
39
+
You can specify a different ECMAScript version using the `js.ecmascript-version` flag; note that this might conflict with full Nashorn compatibilty.
40
+
A code example how to set the flag is given near the end of this section.
The `js.ecmascript-version` option can be set in similar fashion.
72
+
As this is a supported option, there is no need to provide the `experimental-options` flag just for setting the `ecmascript-version`:
73
+
1. by using a command line option:
74
+
```shell
75
+
js --js.ecmascript-version=2020
76
+
```
77
+
67
78
## Nashorn Syntax Extensions
68
79
69
80
[Nashorn syntax extensions](https://wiki.openjdk.java.net/display/Nashorn/Nashorn+extensions) can be enabled using the `js.syntax-extensions` experimental option.
Copy file name to clipboardExpand all lines: docs/user/Options.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ The following options are currently available:
39
39
*`--js.annex-b`: enable ECMAScript Annex B web compatibility features. Boolean value, default is `true`.
40
40
*`--js.array-sort-inherited`: define whether `Array.protoype.sort` should sort inherited keys (implementation-defined behavior). Boolean value, default is `true`.
41
41
*`--js.atomics`: enable *ES2017 Atomics*. Boolean value, default is `true`.
42
-
*`--js.ecmascript-version`: emulate a specific ECMAScript version. Integer value (`5`-`9`), default is the latest version.
42
+
*`--js.ecmascript-version`: emulate a specific ECMAScript version. Integer value (`5`-`13`, or `2015`-`2022`), default is the latest stable version.
43
43
*`--js.foreign-object-prototype`: provide JavaScript's default prototype to foreign objects that mimic JavaScript's own types (foreign Arrays, Objects and Functions). Boolean value, default is `false`.
44
44
*`--js.intl-402`: enable ECMAScript Internationalization API. Boolean value, default is `false`.
45
45
*`--js.regexp-static-result`: provide static `RegExp` properties containing the results of the last successful match, e.g., `RegExp.$1` (legacy). Boolean value, default is `true`.
@@ -72,8 +72,7 @@ See [ScriptEngine Implementation](ScriptEngine.md) on how to use experimental op
72
72
73
73
This option provides compatibility to a specific version of the ECMAScript specification.
74
74
It expects an integer value, where both the counting version numbers (`5` to `11`) and the publication years (starting from `2015`) are supported.
75
-
The default in the development version of GraalVM is the current draft of the specification, currently the [`ECMAScript 2021 draft specification`](https://tc39.es/ecma262/).
76
-
Thus, starting with GraalVM 21.0.0, the default will move to the draft ECMAScript 2021 specification.
75
+
The default in the development version of GraalVM is the [`ECMAScript 2021 specification`](https://tc39.es/ecma262/).
77
76
GraalVM JavaScript implements some features of the future draft specification and of open proposals, if you explicitly select that version and/or enable specific experimental flags.
78
77
For production settings, it is recommended to set the `ecmascript-version` to an existing, finalized version of the specification.
79
78
@@ -84,10 +83,12 @@ Available versions are:
84
83
*`8` or `2017` for ECMAScript 2017
85
84
*`9` or `2018` for ECMAScript 2018
86
85
*`10` or `2019` for ECMAScript 2019
87
-
*`11` or `2020` for ECMAScript 2020 (latest finalized version of the specification)
88
-
*`12` or `2021` for ECMAScript 2021 (**default**, currently in draft stage)
86
+
*`11` or `2020` for ECMAScript 2020
87
+
*`12` or `2021` for ECMAScript 2021 (**default**, latest finalized version of the specification)
89
88
*`13` or `2022` for ECMAScript 2022 (future changes and proposals)
90
89
90
+
As of GraalVM 21.2, the flag can also be set to `latest` or `staging`, to use the latest stable version (which is the default), or the staging version including experimental functionality under development.
91
+
91
92
## intl-402
92
93
93
94
This option enables ECMAScript's [Internationalization API](https://tc39.github.io/ecma402/).
Copy file name to clipboardExpand all lines: docs/user/ScriptEngine.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,8 @@ These options are:
22
22
*`polyglot.js.allowHostClassLookup <boolean or Predicate<String>>`
23
23
*`polyglot.js.allowHostClassLoading <boolean>`
24
24
*`polyglot.js.allowAllAccess <boolean>`
25
+
*`polyglot.js.nashorn-compat <boolean>`
26
+
*`polyglot.js.ecmascript-version <String>`
25
27
26
28
These options control the sandboxing rules applied to evaluated JavaScript code and are set to `false` by default, unless the application was started in the Nashorn compatibility mode (`--js.nashorn-compat=true`).
0 commit comments