Skip to content

Commit

Permalink
ScriptEngine of Graal.js should use Nashorn-compatibility options.
Browse files Browse the repository at this point in the history
PullRequest: js/407
  • Loading branch information
iamstolis committed Jul 18, 2018
2 parents 87912d7 + 72506ce commit 50995a3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The main focus is on user-observable behavior of the engine.
* Add support for `String.prototype.matchAll`, a Stage 3 proposal.
* Implement optional catch binding proposal, targeted for ES2019.
* removed legacy `NashornExtensions` option, use `--js.nashorn-compat` instead.
* Nashorn compatibility mode was turned on for ScriptEngine provided by Graal JavaScript.

## Version 1.0.0 RC4
* Added stack trace limit option (--js.stack-trace-limit).
Expand Down
1 change: 1 addition & 0 deletions docs/user/NashornMigrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Note that, depending on the build setup, GraalVM might still ship Nashorn and it

### ScriptEngine name `graal.js`
Graal JavaScript is shipped with ScriptEngine support.
Nashorn compatibility mode is turned on for this ScriptEngine.
It registers under several names, including `graal.js`.
Depending on the build setup, GraalVM might still ship Nashorn and provide it via ScriptEngine.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public final class GraalJSScriptEngine extends AbstractScriptEngine implements C
Context.Builder contextConfigToUse = contextConfig;
if (contextConfigToUse == null) {
// default config
contextConfigToUse = Context.newBuilder(ID).allowHostAccess(true).allowCreateThread(true);
contextConfigToUse = Context.newBuilder(ID).allowHostAccess(true).allowCreateThread(true).option("js.nashorn-compat", "true").option("js.syntax-extensions", "true");
}
this.factory = new GraalJSEngineFactory(engineToUse);
this.contextConfig = contextConfigToUse.engine(engineToUse);
Expand Down

0 comments on commit 50995a3

Please sign in to comment.