From 5bc4dc61a335b629140887b7b8345078d372446c Mon Sep 17 00:00:00 2001 From: Tony Germano <39179051+tonygermano@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:18:03 -0400 Subject: [PATCH 1/2] Update Shell to use Context.VERSION_ES6 by default resolves https://github.com/mozilla/rhino/issues/1279 --- .../org/mozilla/javascript/tools/shell/ShellContextFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/ShellContextFactory.java b/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/ShellContextFactory.java index f43cc1a69c..61c96fc17c 100644 --- a/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/ShellContextFactory.java +++ b/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/ShellContextFactory.java @@ -13,7 +13,7 @@ public class ShellContextFactory extends ContextFactory { private boolean strictMode; private boolean warningAsError; - private int languageVersion = Context.VERSION_1_8; + private int languageVersion = Context.VERSION_ES6; private int optimizationLevel; private boolean generatingDebug; private boolean allowReservedKeywords = true; From ee2b9b17b25fd0fb1f0474460971a1c5efeb3017 Mon Sep 17 00:00:00 2001 From: Tony Germano Date: Thu, 29 Aug 2024 21:36:05 -0400 Subject: [PATCH 2/2] Set MozillaSuiteTest language version explicitly to 1.8 Several tests failed after changing the ShellContextFactory default language version to ES6. --- .../java/org/mozilla/javascript/tests/MozillaSuiteTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/src/test/java/org/mozilla/javascript/tests/MozillaSuiteTest.java b/tests/src/test/java/org/mozilla/javascript/tests/MozillaSuiteTest.java index 1434700c98..070e86b404 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/MozillaSuiteTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/MozillaSuiteTest.java @@ -21,6 +21,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; +import org.mozilla.javascript.Context; import org.mozilla.javascript.drivers.JsTestsBase; import org.mozilla.javascript.drivers.ShellTest; import org.mozilla.javascript.drivers.TestUtils; @@ -194,6 +195,7 @@ public void runMozillaTest() throws Exception { // optimizationLevel); final ShellContextFactory shellContextFactory = new ShellContextFactory(); shellContextFactory.setOptimizationLevel(optimizationLevel); + shellContextFactory.setLanguageVersion(Context.VERSION_1_8); ShellTestParameters params = new ShellTestParameters(); JunitStatus status = new JunitStatus(); ShellTest.runNoFork(shellContextFactory, jsFile, params, status);