Skip to content

Commit 1d2d4c9

Browse files
rbrigbrail
authored andcommitted
drop support for VERSION_1_4
1 parent 99ab20a commit 1d2d4c9

File tree

20 files changed

+114
-144
lines changed

20 files changed

+114
-144
lines changed

rhino-engine/src/test/java/org/mozilla/javascript/tests/scriptengine/ScriptEngineTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public void languageVersion() throws ScriptException {
235235

236236
// Older language versions
237237
ScriptEngine oldEngine = manager.getEngineByName("rhino");
238-
oldEngine.put(ScriptEngine.LANGUAGE_VERSION, 140);
238+
oldEngine.put(ScriptEngine.LANGUAGE_VERSION, 150);
239239
assertThrows(
240240
ScriptException.class,
241241
() -> {
@@ -244,7 +244,7 @@ public void languageVersion() throws ScriptException {
244244

245245
// The same with a string
246246
ScriptEngine olderEngine = manager.getEngineByName("rhino");
247-
olderEngine.put(ScriptEngine.LANGUAGE_VERSION, "140");
247+
olderEngine.put(ScriptEngine.LANGUAGE_VERSION, "150");
248248
assertThrows(
249249
ScriptException.class,
250250
() -> {

rhino/src/main/java/org/mozilla/javascript/Context.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ public class Context implements Closeable {
8787
*/
8888
public static final int VERSION_DEFAULT = 0;
8989

90-
/** JavaScript 1.4 */
91-
public static final int VERSION_1_4 = 140;
92-
9390
/** JavaScript 1.5 */
9491
public static final int VERSION_1_5 = 150;
9592

@@ -711,7 +708,6 @@ public void setLanguageVersion(int version) {
711708
public static boolean isValidLanguageVersion(int version) {
712709
switch (version) {
713710
case VERSION_DEFAULT:
714-
case VERSION_1_4:
715711
case VERSION_1_5:
716712
case VERSION_1_6:
717713
case VERSION_1_7:

rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5532,12 +5532,9 @@ public static Object[] getArrayElements(Scriptable object) {
55325532
}
55335533

55345534
static void checkDeprecated(Context cx, String name) {
5535-
int version = cx.getLanguageVersion();
5536-
if (version >= Context.VERSION_1_4 || version == Context.VERSION_DEFAULT) {
5537-
String msg = getMessageById("msg.deprec.ctor", name);
5538-
if (version == Context.VERSION_DEFAULT) Context.reportWarning(msg);
5539-
else throw Context.reportRuntimeError(msg);
5540-
}
5535+
String msg = getMessageById("msg.deprec.ctor", name);
5536+
if (cx.getLanguageVersion() == Context.VERSION_DEFAULT) Context.reportWarning(msg);
5537+
else throw Context.reportRuntimeError(msg);
55415538
}
55425539

55435540
/**

rhino/src/main/java/org/mozilla/javascript/regexp/RegExpImpl.java

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -437,43 +437,29 @@ private static SubString interpretDollar(
437437

438438
/* Allow a real backslash (literal "\\") to escape "$1" etc. */
439439
int version = cx.getLanguageVersion();
440-
if (version != Context.VERSION_DEFAULT && version <= Context.VERSION_1_4) {
441-
if (dp > 0 && da.charAt(dp - 1) == '\\') return null;
442-
}
443440
int daL = da.length();
444441
if (dp + 1 >= daL) return null;
445442
/* Interpret all Perl match-induced dollar variables. */
446443
dc = da.charAt(dp + 1);
447444
if (NativeRegExp.isDigit(dc)) {
448445
int cp;
449-
if (version != Context.VERSION_DEFAULT && version <= Context.VERSION_1_4) {
450-
if (dc == '0') return null;
451-
/* Check for overflow to avoid gobbling arbitrary decimal digits. */
452-
num = 0;
453-
cp = dp;
454-
while (++cp < daL && NativeRegExp.isDigit(dc = da.charAt(cp))) {
446+
/* ECMA 3, 1-9 or 01-99 */
447+
int parenCount = (res.parens == null) ? 0 : res.parens.length;
448+
num = dc - '0';
449+
if (num > parenCount) return null;
450+
cp = dp + 2;
451+
if ((dp + 2) < daL) {
452+
dc = da.charAt(dp + 2);
453+
if (NativeRegExp.isDigit(dc)) {
455454
tmp = 10 * num + (dc - '0');
456-
if (tmp < num) break;
457-
num = tmp;
458-
}
459-
} else {
460-
/* ECMA 3, 1-9 or 01-99 */
461-
int parenCount = (res.parens == null) ? 0 : res.parens.length;
462-
num = dc - '0';
463-
if (num > parenCount) return null;
464-
cp = dp + 2;
465-
if ((dp + 2) < daL) {
466-
dc = da.charAt(dp + 2);
467-
if (NativeRegExp.isDigit(dc)) {
468-
tmp = 10 * num + (dc - '0');
469-
if (tmp <= parenCount) {
470-
cp++;
471-
num = tmp;
472-
}
455+
if (tmp <= parenCount) {
456+
cp++;
457+
num = tmp;
473458
}
474459
}
475-
if (num == 0) return null; /* $0 or $00 is not valid */
476460
}
461+
if (num == 0) return null; /* $0 or $00 is not valid */
462+
477463
/* Adjust num from 1 $n-origin to 0 array-index-origin. */
478464
num--;
479465
skip[0] = cp - dp;

tests/src/test/java/org/mozilla/javascript/tests/backwardcompat/BackwardParseInt.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@
55

66
public class BackwardParseInt {
77

8-
@Test
9-
public void parseIntOctal_1_4() {
10-
Utils.assertWithAllModes_1_4(7, "parseInt('07');");
11-
Utils.assertWithAllModes_1_4(7, "parseInt('007');");
12-
Utils.assertWithAllModes_1_4(-56, "parseInt('-070');");
13-
Utils.assertWithAllModes_1_4(Double.NaN, "parseInt('08');");
14-
Utils.assertWithAllModes_1_4(0, "parseInt('008');");
15-
Utils.assertWithAllModes_1_4(Double.NaN, "parseInt('-090');");
16-
}
17-
188
@Test
199
public void parseIntOctal_1_5() {
2010
Utils.assertWithAllModes_1_5(7, "parseInt('07');");

tests/testsrc/doctests/version.doctest

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
js> version()
66
0
7-
js> version(140)
8-
140
97
js> version(150)
108
150
119
js> version(160)

tests/testsrc/tests/ecma/GlobalObject/15.1.2.2-2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ new TestCase( SECTION,
123123

124124
new TestCase( SECTION,
125125
'parseInt("0022")',
126-
18,
126+
( VERSION == "140" ? 18 : 22 ),
127127
parseInt("0022"));
128128

129129
new TestCase( SECTION,

tests/testsrc/tests/ecma/TypeConversion/9.3.1-3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ new TestCase( SECTION,
470470

471471
new TestCase( SECTION,
472472
"parseInt(\"0022\")",
473-
18,
473+
( VERSION == "140" ? 18 : 22 ),
474474
parseInt("0022") );
475475

476476
new TestCase( SECTION,

tests/testsrc/tests/ecma/jsref.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,24 @@ function startTest() {
8484
if ( version ) {
8585
// JavaScript 1.3 is supposed to be compliant ecma version 1.0
8686
if ( VERSION == "ECMA_1" ) {
87-
// as of Rhino 2.0 we removed VERSION_1_3 support
88-
// switching to 1.4 for these tests
89-
version ( "140" );
87+
// as of Rhino 2.0 we removed VERSION_1_3 & VERSION_1_4 support
88+
// switching to 1.5 for these tests
89+
version ( "150" );
9090
}
9191
if ( VERSION == "JS_1.3" ) {
92-
// as of Rhino 2.0 we removed VERSION_1_3 support
93-
// switching to 1.4 for these tests
94-
version ( "140" );
92+
// as of Rhino 2.0 we removed VERSION_1_3 & VERSION_1_4 support
93+
// switching to 1.5 for these tests
94+
version ( "150" );
9595
}
9696
if ( VERSION == "JS_1.2" ) {
97-
// as of Rhino 2.0 we removed VERSION_1_2 & VERSION_1_3 support
98-
// switching to 1.4 for these tests
99-
version ( "140" );
97+
// as of Rhino 2.0 we removed VERSION_1_2, VERSION_1_3 & VERSION_1_4 support
98+
// switching to 1.5 for these tests
99+
version ( "150" );
100100
}
101101
if ( VERSION == "JS_1.1" ) {
102-
// as of Rhino 2.0 we removed VERSION_1_1, VERSION_1_2 & VERSION_1_3 support
103-
// switching to 1.4 for these tests
104-
version ( "140" );
102+
// as of Rhino 2.0 we removed VERSION_1_1, VERSION_1_2, VERSION_1_3 & VERSION_1_4 support
103+
// switching to 1.5 for these tests
104+
version ( "150" );
105105
}
106106
// for ecma version 2.0, we will leave the javascript version to
107107
// the default ( for now ).

tests/testsrc/tests/ecma_2/jsref.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,24 @@ function TestCase( n, d, e, a ) {
6565
function startTest() {
6666
// JavaScript 1.3 is supposed to be compliant ecma version 1.0
6767
if ( VERSION == "ECMA_1" ) {
68-
// as of Rhino 2.0 we removed VERSION_1_3 support
69-
// switching to 1.4 for these tests
70-
version ( "140" );
68+
// as of Rhino 2.0 we removed VERSION_1_3 & VERSION_1_4 support
69+
// switching to 1.5 for these tests
70+
version ( "150" );
7171
}
7272
if ( VERSION == "JS_13" ) {
73-
// as of Rhino 2.0 we removed VERSION_1_3 support
74-
// switching to 1.4 for these tests
75-
version ( "140" );
73+
// as of Rhino 2.0 we removed VERSION_1_3 & VERSION_1_4 support
74+
// switching to 1.5 for these tests
75+
version ( "150" );
7676
}
7777
if ( VERSION == "JS_12" ) {
78-
// as of Rhino 2.0 we removed VERSION_1_2 & VERSION_1_3 support
79-
// switching to 1.4 for these tests
80-
version ( "140" );
78+
// as of Rhino 2.0 we removed VERSION_1_2 & VERSION_1_3 & VERSION_1_4 support
79+
// switching to 1.5 for these tests
80+
version ( "150" );
8181
}
8282
if ( VERSION == "JS_11" ) {
83-
// as of Rhino 2.0 we removed VERSION_1_1, VERSION_1_2 & VERSION_1_3 support
84-
// switching to 1.4 for these tests
85-
version ( "140" );
83+
// as of Rhino 2.0 we removed VERSION_1_1, VERSION_1_2, VERSION_1_3 & VERSION_1_4 support
84+
// switching to 1.5 for these tests
85+
version ( "150" );
8686
}
8787
// for ecma version 2.0, we will leave the javascript version to
8888
// the default ( for now ).

0 commit comments

Comments
 (0)