summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/built-ins/RegExp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/annexB/built-ins/RegExp
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/annexB/built-ins/RegExp')
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js55
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js31
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js20
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-invalid-control-escape-character-class-range.js26
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-invalid-control-escape-character-class.js56
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-leading-escape-BMP.js31
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-leading-escape.js16
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-trailing-escape-BMP.js31
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/RegExp-trailing-escape.js16
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/incomplete_hex_unicode_escape.js20
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js35
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-cross-realm-constructor.js33
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-not-regexp-constructor.js63
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-subclass-constructor.js33
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js45
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-cross-realm-constructor.js64
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-not-regexp-constructor.js76
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-subclass-constructor.js64
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js42
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-cross-realm-constructor.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-not-regexp-constructor.js62
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js42
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-cross-realm-constructor.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-not-regexp-constructor.js62
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-subclass-constructor.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js42
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-cross-realm-constructor.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-not-regexp-constructor.js62
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-subclass-constructor.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js42
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-cross-realm-constructor.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-not-regexp-constructor.js62
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-subclass-constructor.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/named-groups/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/named-groups/non-unicode-malformed-lookbehind.js17
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/named-groups/non-unicode-malformed.js27
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/named-groups/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/Symbol.match-getter-recompiles-source.js37
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/toint32-limit-recompiles-source.js34
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/B.RegExp.prototype.compile.js18
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/duplicate-named-capturing-groups-syntax.js23
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-string-invalid.js45
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-to-string-err.js45
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-to-string.js41
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-undefined.js54
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/length.js32
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/name.js29
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-distinct.js39
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-flags-defined.js46
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-immutable-lastindex.js38
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-props.js75
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-same.js34
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid-u.js44
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid.js46
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-u.js53
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string.js44
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-to-string-err.js44
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-undefined.js53
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-cross-realm-instance.js37
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-not-object.js44
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-obj-not-regexp.js32
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js28
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/browser.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/order-after-compile.js37
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/prototype/shell.js0
-rw-r--r--js/src/tests/test262/annexB/built-ins/RegExp/shell.js0
88 files changed, 2531 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js
new file mode 100644
index 0000000000..b7caeb42a5
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "CharacterEscape :: c ControlLetter"
+es5id: 15.10.2.10_A2.1_T3
+es6id: B.1.4
+description: >
+ "ControlLetter :: RUSSIAN ALPHABET is incorrect"
+ Instead, fall back to semantics to match literal "\\c"
+features: [generators]
+---*/
+
+function* invalidControls() {
+ // Check upper case Cyrillic
+ for (var alpha = 0x0410; alpha <= 0x042F; alpha++) {
+ yield String.fromCharCode(alpha);
+ }
+
+ // Check lower case Cyrillic
+ for (alpha = 0x0430; alpha <= 0x044F; alpha++) {
+ yield String.fromCharCode(alpha);
+ }
+
+ // Check ASCII characters which are not in the extended range or syntax
+ // characters
+ for (alpha = 0x00; alpha <= 0x7F; alpha++) {
+ let letter = String.fromCharCode(alpha);
+ if (!letter.match(/[0-9A-Za-z_\$(|)\[\]\/\\^]/)) {
+ yield letter;
+ }
+ }
+
+ // Check for end of string
+ yield "";
+}
+
+for (let letter of invalidControls()) {
+ var source = "\\c" + letter;
+ var re = new RegExp(source);
+
+ if (letter.length > 0) {
+ var char = letter.charCodeAt(0);
+ var str = String.fromCharCode(char % 32);
+ var arr = re.exec(str);
+ assert.sameValue(arr, null, `Character ${letter} unreasonably wrapped around as a control character`);
+ }
+ arr = re.exec(source.substring(1));
+ assert.sameValue(arr, null, `invalid \\c escape matched c rather than \\c when followed by ${letter}`);
+
+ arr = re.exec(source);
+ assert.notSameValue(arr, null, `invalid \\c escape failed to match \\c when followed by ${letter}`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js
new file mode 100644
index 0000000000..4d49de4ea4
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production CharacterClass :: [ [lookahead \notin {^}] ClassRanges ]
+ evaluates by evaluating ClassRanges to obtain a CharSet and returning
+ that CharSet and the boolean false
+es5id: 15.10.2.13_A1_T16
+es6id: B.1.4
+description: >
+ Execute /[\d][\12-\14]{1,}[^\d]/.exec("line1\n\n\n\n\nline2") and
+ check results
+---*/
+
+var __executed = /[\d][\12-\14]{1,}[^\d]/.exec("line1\n\n\n\n\nline2");
+
+var __expected = ["1\n\n\n\n\nl"];
+__expected.index = 4;
+__expected.input = "line1\n\n\n\n\nline2";
+
+assert.sameValue(__executed.length, __expected.length, '.length');
+assert.sameValue(__executed.index, __expected.index, '.index');
+assert.sameValue(__executed.input, __expected.input, '.input');
+
+//CHECK#4
+for(var index=0; index < __expected.length; index++) {
+ assert.sameValue(__executed[index], __expected[index], 'index: ' + index);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js
new file mode 100644
index 0000000000..cd0bf7ed7e
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ An escape sequence of the form \ followed by a nonzero decimal number n
+ matches the result of the nth set of capturing parentheses (see
+ 15.10.2.11)
+es5id: 15.10.2.9_A1_T4
+es6id: B.1.4
+description: >
+ Execute /\b(\w+) \2\b/.test("do you listen the the band") and
+ check results
+---*/
+
+var executed = /\b(\w+) \2\b/.test("do you listen the the band");
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-invalid-control-escape-character-class-range.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-invalid-control-escape-character-class-range.js
new file mode 100644
index 0000000000..011790acdf
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-invalid-control-escape-character-class-range.js
@@ -0,0 +1,26 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-annexB-ClassAtomNoDash
+description: >
+ Invalid \c in a range behaves like [\\c-_]
+info: |
+ ClassAtomNoDash :: `\`
+
+ The production ClassAtomNoDash :: `\` evaluates as follows:
+ 1. Return the CharSet containing the single character `\`.
+---*/
+
+let re = /[\\c-f]/
+
+assert(re.test("\\"))
+assert(!re.test("b"))
+assert(re.test("c"))
+assert(re.test("d"))
+assert(re.test("e"))
+assert(re.test("f"))
+assert(!re.test("g"))
+assert(!re.test("-"))
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-invalid-control-escape-character-class.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-invalid-control-escape-character-class.js
new file mode 100644
index 0000000000..0e9451e537
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-invalid-control-escape-character-class.js
@@ -0,0 +1,56 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-annexB-ClassAtomNoDash
+description: >
+ Character classes containing an invalid control escape behave like [\\c]
+info: |
+ ClassAtomNoDash :: `\`
+
+ The production ClassAtomNoDash :: `\` evaluates as follows:
+ 1. Return the CharSet containing the single character `\`.
+features: [generators]
+---*/
+
+function* invalidControls() {
+ // Check ASCII characters which are not in the extended range or syntax
+ // characters
+ for (let alpha = 0x00; alpha <= 0x7F; alpha++) {
+ let letter = String.fromCharCode(alpha);
+ if (!letter.match(/[0-9A-Za-z_\$(|)\[\]\/\\^]/)) {
+ yield letter;
+ }
+ }
+ yield "";
+}
+
+for (let letter of invalidControls()) {
+ var source = "[\\c" + letter + "]";
+ var re = new RegExp(source);
+
+ if (letter.length > 0) {
+ var char = letter.charCodeAt(0);
+ var str = String.fromCharCode(char % 32);
+ var arr = re.exec(str);
+ if (str !== letter && arr !== null) {
+ throw new Test262Error(`Character ${letter} unreasonably wrapped around as a control character`);
+ }
+
+ arr = re.exec(letter);
+ if (arr === null) {
+ throw new Test262Error(`Character ${letter} missing from character class ${source}`);
+ }
+ }
+ arr = re.exec("\\")
+ if (arr === null) {
+ throw new Test262Error(`Character \\ missing from character class ${source}`);
+ }
+ arr = re.exec("c")
+ if (arr === null) {
+ throw new Test262Error(`Character c missing from character class ${source}`);
+ }
+}
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-leading-escape-BMP.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-leading-escape-BMP.js
new file mode 100644
index 0000000000..011e7aeac6
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-leading-escape-BMP.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegularExpressionFirstChar :: BackslashSequence :: \NonTerminator,
+ RegularExpressionChars :: [empty], RegularExpressionFlags :: [empty]
+es5id: 7.8.5_A1.4_T2
+es6id: 11.8.5
+description: Complex test with eval, using syntax pattern
+---*/
+
+for (var cu = 0; cu <= 0xffff; ++cu) {
+ var Elimination =
+ ((cu === 0x002A) || (cu === 0x002F) || (cu === 0x005C) || (cu === 0x002B) ||
+ (cu === 0x003F) || (cu === 0x0028) || (cu === 0x0029) ||
+ (cu === 0x005B) || (cu === 0x005D) || (cu === 0x007B) || (cu === 0x007D));
+ /*
+ * \u002A / \u002F \ \u005C + \u002B
+ ? \u003F ( \u0028 ) \u0029
+ [ \u005B ] \u005D { \u007B } \u007D
+ */
+ var LineTerminator = ((cu === 0x000A) || (cu === 0x000D) || (cu === 0x2028) || (cu === 0x2029));
+ if ((Elimination || LineTerminator ) === false) {
+ var xx = "\\" + String.fromCharCode(cu);
+ var pattern = eval("/" + xx + "/");
+ assert.sameValue(pattern.source, xx, "Code unit: " + cu.toString(16));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-leading-escape.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-leading-escape.js
new file mode 100644
index 0000000000..4b6c50fb00
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-leading-escape.js
@@ -0,0 +1,16 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegularExpressionFirstChar :: BackslashSequence :: \NonTerminator,
+ RegularExpressionChars :: [empty], RegularExpressionFlags :: [empty]
+es5id: 7.8.5_A1.4_T1
+es6id: 11.8.5
+description: Check similar to (/\1/.source === "\\1")
+---*/
+
+assert.sameValue(/\1/.source, "\\1");
+assert.sameValue(/\a/.source, "\\a");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-trailing-escape-BMP.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-trailing-escape-BMP.js
new file mode 100644
index 0000000000..76ad15761d
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-trailing-escape-BMP.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegularExpressionChar :: BackslashSequence :: \NonTerminator,
+ RegularExpressionFlags :: [empty]
+es5id: 7.8.5_A2.4_T2
+es6id: 11.8.5
+description: Complex test with eval, using syntax pattern
+---*/
+
+for (var cu = 0; cu <= 0xffff; ++cu) {
+ var Elimination =
+ ((cu === 0x002A) || (cu === 0x002F) || (cu === 0x005C) || (cu === 0x002B) ||
+ (cu === 0x003F) || (cu === 0x0028) || (cu === 0x0029) ||
+ (cu === 0x005B) || (cu === 0x005D) || (cu === 0x007B) || (cu === 0x007D));
+ /*
+ * \u002A / \u002F \ \u005C + \u002B
+ ? \u003F ( \u0028 ) \u0029
+ [ \u005B ] \u005D { \u007B } \u007D
+ */
+ var LineTerminator = ((cu === 0x000A) || (cu === 0x000D) || (cu === 0x2028) || (cu === 0x2029));
+ if ((Elimination || LineTerminator ) === false) {
+ var xx = "a\\" + String.fromCharCode(cu);
+ var pattern = eval("/" + xx + "/");
+ assert.sameValue(pattern.source, xx, "Code unit: " + cu.toString(16));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-trailing-escape.js b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-trailing-escape.js
new file mode 100644
index 0000000000..9af5e0ccf9
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/RegExp-trailing-escape.js
@@ -0,0 +1,16 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegularExpressionChar :: BackslashSequence :: \NonTerminator,
+ RegularExpressionFlags :: [empty]
+es5id: 7.8.5_A2.4_T1
+es6id: 11.8.5
+description: Check similar to (/a\1/.source === "a\\1")
+---*/
+
+assert.sameValue(/a\1/.source, "a\\1");
+assert.sameValue(/a\a/.source, "a\\a");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/incomplete_hex_unicode_escape.js b/js/src/tests/test262/annexB/built-ins/RegExp/incomplete_hex_unicode_escape.js
new file mode 100644
index 0000000000..915c303f3f
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/incomplete_hex_unicode_escape.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2015 Zirak. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: An incomplete HexEscape or UnicodeEscape should be treated as an Identity Escape
+info: |
+ An incomplete HexEscape (e.g. /\x/) or UnicodeEscape (/\u/) should fall
+ through to IdentityEscape
+esid: prod-AtomEscape
+---*/
+
+// Hex escape
+assert(/\x/.test("x"), "/\\x/");
+assert(/\xa/.test("xa"), "/\\xa/");
+
+// Unicode escape
+assert(/\u/.test("u"), "/\\u/");
+assert(/\ua/.test("ua"), "/\\ua/");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js
new file mode 100644
index 0000000000..7f11026dbc
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js
@@ -0,0 +1,35 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Property descriptor for RegExp.$1-$9
+info: |
+ RegExp.$1-$9 are accessor properties with attributes
+ {
+ [[Enumerable]]: false,
+ [[Configurable]]: true,
+ [[Set]]: undefined,
+ }
+
+ get RegExp.$1-$9
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpParen1-9]]).
+includes: [propertyHelper.js]
+features: [legacy-regexp]
+---*/
+
+for (let i = 1; i <= 9; i++) {
+ const property = "$" + i;
+ const desc = Object.getOwnPropertyDescriptor(RegExp, property);
+
+ assert.sameValue(desc.set, undefined, property + " setter");
+ assert.sameValue(typeof desc.get, "function", property + " getter");
+
+ verifyProperty(RegExp, property, {
+ enumerable: false,
+ configurable: true
+ });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-cross-realm-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-cross-realm-constructor.js
new file mode 100644
index 0000000000..885e64fcc0
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-cross-realm-constructor.js
@@ -0,0 +1,33 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.$1-$9 throw a TypeError for cross-realm receiver
+info: |
+ get RegExp.$1-$9
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpParen1-9]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,cross-realm,Reflect]
+---*/
+
+const other = $262.createRealm().global;
+
+for (let i = 1; i <= 9; i++) {
+ const property = "$" + i;
+ assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, property, other.RegExp);
+ },
+ "RegExp." + property + " getter throws for cross-realm receiver"
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-not-regexp-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-not-regexp-constructor.js
new file mode 100644
index 0000000000..5afd16c0fb
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-not-regexp-constructor.js
@@ -0,0 +1,63 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.$1-$9 throw a TypeError for non-%RegExp% receiver
+info: |
+ get RegExp.$1-$9
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpParen1-9]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp]
+---*/
+
+for (let i = 1; i <= 9; i++) {
+ const property = "$" + i;
+ const desc = Object.getOwnPropertyDescriptor(RegExp, property);
+
+ // Similar to the other test verifying the descriptor, but split as properties can be removed or changed
+ assert.sameValue(typeof desc.get, "function", property + " getter");
+
+ // If SameValue(C, thisValue) is false, throw a TypeError exception.
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get();
+ },
+ "RegExp." + property + " getter throws for property descriptor receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(/ /);
+ },
+ "RegExp." + property + " getter throws for RegExp instance receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(RegExp.prototype);
+ },
+ "RegExp." + property + " getter throws for %RegExp.prototype% receiver"
+ );
+
+ [undefined, null, {}, true, false, 0, 1, "string"].forEach(function (value) {
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(value);
+ },
+ "RegExp." + property + ' getter throws for primitive "' + value + '" receiver'
+ );
+ });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-subclass-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-subclass-constructor.js
new file mode 100644
index 0000000000..99970a8332
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-subclass-constructor.js
@@ -0,0 +1,33 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.$1-$9 throw a TypeError for subclass receiver
+info: |
+ get RegExp.$1-$9
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpParen1-9]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,class]
+---*/
+
+class MyRegExp extends RegExp {}
+
+for (let i = 1; i <= 9; i++) {
+ const property = "$" + i;
+ assert.throws(
+ TypeError,
+ function () {
+ MyRegExp[property];
+ },
+ "RegExp." + property + " getter throws for subclass receiver"
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js
new file mode 100644
index 0000000000..e5f0c85603
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js
@@ -0,0 +1,45 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Property descriptor for RegExp.input
+info: |
+ RegExp.input is an accessor property with attributes:
+ {
+ [[Enumerable]]: false,
+ [[Configurable]]: true,
+ }
+
+ get RegExp.input
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]]).
+
+ set RegExp.input = val
+
+ 1. Return ? SetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]], val).
+includes: [propertyHelper.js]
+features: [legacy-regexp]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(RegExp, "input");
+
+assert.sameValue(typeof desc.get, "function", "`get` property");
+assert.sameValue(typeof desc.set, "function", "`set` property");
+
+verifyProperty(RegExp, "input", {
+ enumerable: false,
+ configurable: true
+});
+
+desc = Object.getOwnPropertyDescriptor(RegExp, "$_");
+
+assert.sameValue(typeof desc.get, "function", "`get` property");
+assert.sameValue(typeof desc.set, "function", "`set` property");
+
+verifyProperty(RegExp, "$_", {
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-cross-realm-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-cross-realm-constructor.js
new file mode 100644
index 0000000000..a7f0446619
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-cross-realm-constructor.js
@@ -0,0 +1,64 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.input throws a TypeError for cross-realm receiver
+info: |
+ get RegExp.input
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]]).
+
+ set RegExp.input = val
+
+ 1. Return ? SetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]], val).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+
+ SetLegacyRegExpStaticProperty( C, thisValue, internalSlotName, val ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,cross-realm,Reflect,Reflect.set]
+---*/
+
+const other = $262.createRealm().global;
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "input", other.RegExp);
+ },
+ "RegExp.input getter throws for cross-realm receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.set(RegExp, "input", "", other.RegExp);
+ },
+ "RegExp.input setter throws for cross-realm receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "$_", other.RegExp);
+ },
+ "RegExp.$_ getter throws for cross-realm receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.set(RegExp, "$_", "", other.RegExp);
+ },
+ "RegExp.$_ setter throws for cross-realm receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-not-regexp-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-not-regexp-constructor.js
new file mode 100644
index 0000000000..4a8a7ff3c6
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-not-regexp-constructor.js
@@ -0,0 +1,76 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.input throws a TypeError for non-%RegExp% receiver
+info: |
+ get RegExp.input
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]]).
+
+ set RegExp.input = val
+
+ 1. Return ? SetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]], val).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+
+ SetLegacyRegExpStaticProperty( C, thisValue, internalSlotName, val ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp]
+---*/
+
+["input", "$_"].forEach(function (property) {
+ const desc = Object.getOwnPropertyDescriptor(RegExp, property);
+
+ ["get", "set"].forEach(function (accessor) {
+ const messagePrefix = "RegExp." + property + " " + accessor + "ter";
+
+ // Similar to the other test verifying the descriptor, but split as properties can be removed or changed
+ assert.sameValue(typeof desc[accessor], "function", messagePrefix);
+
+ // If SameValue(C, thisValue) is false, throw a TypeError exception.
+ assert.throws(
+ TypeError,
+ function () {
+ desc[accessor]();
+ },
+ messagePrefix + " throws for property descriptor receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc[accessor].call(/ /);
+ },
+ messagePrefix + " throws for RegExp instance receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc[accessor].call(RegExp.prototype);
+ },
+ messagePrefix + " throws for %RegExp.prototype% receiver"
+ );
+
+ [undefined, null, {}, true, false, 0, 1, "string"].forEach(function (value) {
+ assert.throws(
+ TypeError,
+ function () {
+ desc[accessor].call(value);
+ },
+ messagePrefix + ' throws for primitive "' + value + '" receiver'
+ );
+ });
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-subclass-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-subclass-constructor.js
new file mode 100644
index 0000000000..beb7c8c66d
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-subclass-constructor.js
@@ -0,0 +1,64 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.input throws a TypeError for subclass receiver
+info: |
+ get RegExp.input
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]]).
+
+ set RegExp.input = val
+
+ 1. Return ? SetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]], val).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+
+ SetLegacyRegExpStaticProperty( C, thisValue, internalSlotName, val ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,class]
+---*/
+
+class MyRegExp extends RegExp {}
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp.input;
+ },
+ "RegExp.input getter throws for subclass receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp.input = "";
+ },
+ "RegExp.input setter throws for subclass receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp.$_;
+ },
+ "RegExp.$_ getter throws for subclass receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp.$_ = "";
+ },
+ "RegExp.$_ setter throws for subclass receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js
new file mode 100644
index 0000000000..62854362c5
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js
@@ -0,0 +1,42 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Property descriptor for RegExp.lastMatch
+info: |
+ RegExp.lastMatch is an accessor property with attributes:
+ {
+ [[Enumerable]]: false,
+ [[Configurable]]: true,
+ [[Set]]: undefined,
+ }
+
+ get RegExp.lastMatch
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastMatch]]).
+includes: [propertyHelper.js]
+features: [legacy-regexp]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(RegExp, "lastMatch");
+
+assert.sameValue(desc.set, undefined, "`set` property");
+assert.sameValue(typeof desc.get, "function", "`get` property");
+
+verifyProperty(RegExp, "lastMatch", {
+ enumerable: false,
+ configurable: true
+});
+
+desc = Object.getOwnPropertyDescriptor(RegExp, "$&");
+
+assert.sameValue(desc.set, undefined, "`set` property");
+assert.sameValue(typeof desc.get, "function", "`get` property");
+
+verifyProperty(RegExp, "$&", {
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-cross-realm-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-cross-realm-constructor.js
new file mode 100644
index 0000000000..c9b7c97abc
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-cross-realm-constructor.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.lastMatch throws a TypeError for cross-realm receiver
+info: |
+ get RegExp.lastMatch
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastMatch]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,cross-realm,Reflect]
+---*/
+
+const other = $262.createRealm().global;
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "lastMatch", other.RegExp);
+ },
+ "RegExp.lastMatch getter throws for cross-realm receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "$&", other.RegExp);
+ },
+ "RegExp.$& getter throws for cross-realm receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-not-regexp-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-not-regexp-constructor.js
new file mode 100644
index 0000000000..35ad7711f6
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-not-regexp-constructor.js
@@ -0,0 +1,62 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.lastMatch throws a TypeError for non-%RegExp% receiver
+info: |
+ get RegExp.lastMatch
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastMatch]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp]
+---*/
+
+["lastMatch", "$&"].forEach(function (property) {
+ const desc = Object.getOwnPropertyDescriptor(RegExp, property);
+
+ // Similar to the other test verifying the descriptor, but split as properties can be removed or changed
+ assert.sameValue(typeof desc.get, "function", property + " getter");
+
+ // If SameValue(C, thisValue) is false, throw a TypeError exception.
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get();
+ },
+ "RegExp." + property + " getter throws for property descriptor receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(/ /);
+ },
+ "RegExp." + property + " getter throws for RegExp instance receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(RegExp.prototype);
+ },
+ "RegExp." + property + " getter throws for %RegExp.prototype% receiver"
+ );
+
+ [undefined, null, {}, true, false, 0, 1, "string"].forEach(function (value) {
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(value);
+ },
+ "RegExp." + property + ' getter throws for primitive "' + value + '" receiver'
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js
new file mode 100644
index 0000000000..510697fd06
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.lastMatch throws a TypeError for subclass receiver
+info: |
+ get RegExp.lastMatch
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastMatch]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,class]
+---*/
+
+class MyRegExp extends RegExp {}
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp.lastMatch;
+ },
+ "RegExp.lastMatch getter throws for subclass receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp["$&"];
+ },
+ "RegExp.$& getter throws for subclass receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js
new file mode 100644
index 0000000000..cc8c0adc10
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js
@@ -0,0 +1,42 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Property descriptor for RegExp.lastParen
+info: |
+ RegExp.lastParen is an accessor property with attributes:
+ {
+ [[Enumerable]]: false,
+ [[Configurable]]: true,
+ [[Set]]: undefined,
+ }
+
+ get RegExp.lastParen
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastParen]]).
+includes: [propertyHelper.js]
+features: [legacy-regexp]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(RegExp, "lastParen");
+
+assert.sameValue(desc.set, undefined, "`set` property");
+assert.sameValue(typeof desc.get, "function", "`get` property");
+
+verifyProperty(RegExp, "lastParen", {
+ enumerable: false,
+ configurable: true
+});
+
+desc = Object.getOwnPropertyDescriptor(RegExp, "$+");
+
+assert.sameValue(desc.set, undefined, "`set` property");
+assert.sameValue(typeof desc.get, "function", "`get` property");
+
+verifyProperty(RegExp, "$+", {
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-cross-realm-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-cross-realm-constructor.js
new file mode 100644
index 0000000000..39b723d8d9
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-cross-realm-constructor.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.lastParen throws a TypeError for cross-realm receiver
+info: |
+ get RegExp.lastParen
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastParen]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,cross-realm,Reflect]
+---*/
+
+const other = $262.createRealm().global;
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "lastParen", other.RegExp);
+ },
+ "RegExp.lastParen getter throws for cross-realm receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "$+", other.RegExp);
+ },
+ "RegExp.$+ getter throws for cross-realm receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-not-regexp-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-not-regexp-constructor.js
new file mode 100644
index 0000000000..bd36699732
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-not-regexp-constructor.js
@@ -0,0 +1,62 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.lastParen throws a TypeError for non-%RegExp% receiver
+info: |
+ get RegExp.lastParen
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastParen]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp]
+---*/
+
+["lastParen", "$+"].forEach(function (property) {
+ const desc = Object.getOwnPropertyDescriptor(RegExp, property);
+
+ // Similar to the other test verifying the descriptor, but split as properties can be removed or changed
+ assert.sameValue(typeof desc.get, "function", property + " getter");
+
+ // If SameValue(C, thisValue) is false, throw a TypeError exception.
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get();
+ },
+ "RegExp." + property + " getter throws for property descriptor receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(/ /);
+ },
+ "RegExp." + property + " getter throws for RegExp instance receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(RegExp.prototype);
+ },
+ "RegExp." + property + " getter throws for %RegExp.prototype% receiver"
+ );
+
+ [undefined, null, {}, true, false, 0, 1, "string"].forEach(function (value) {
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(value);
+ },
+ "RegExp." + property + ' getter throws for primitive "' + value + '" receiver'
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-subclass-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-subclass-constructor.js
new file mode 100644
index 0000000000..36fdf2cd3c
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-subclass-constructor.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.lastParen throws a TypeError for subclass receiver
+info: |
+ get RegExp.lastParen
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastParen]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,class]
+---*/
+
+class MyRegExp extends RegExp {}
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp.lastParen;
+ },
+ "RegExp.lastParen getter throws for subclass receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp["$+"];
+ },
+ "RegExp.$+ getter throws for subclass receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js
new file mode 100644
index 0000000000..7504bdab79
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js
@@ -0,0 +1,42 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Property descriptor for RegExp.leftContext
+info: |
+ RegExp.leftContext is an accessor property with attributes:
+ {
+ [[Enumerable]]: false,
+ [[Configurable]]: true,
+ [[Set]]: undefined,
+ }
+
+ get RegExp.leftContext
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLeftContext]]).
+includes: [propertyHelper.js]
+features: [legacy-regexp]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(RegExp, "leftContext");
+
+assert.sameValue(desc.set, undefined, "`set` property");
+assert.sameValue(typeof desc.get, "function", "`get` property");
+
+verifyProperty(RegExp, "leftContext", {
+ enumerable: false,
+ configurable: true
+});
+
+desc = Object.getOwnPropertyDescriptor(RegExp, "$`");
+
+assert.sameValue(desc.set, undefined, "`set` property");
+assert.sameValue(typeof desc.get, "function", "`get` property");
+
+verifyProperty(RegExp, "$`", {
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-cross-realm-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-cross-realm-constructor.js
new file mode 100644
index 0000000000..ba4d23f90e
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-cross-realm-constructor.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.leftContext throws a TypeError for cross-realm receiver
+info: |
+ get RegExp.leftContext
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLeftContext]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,cross-realm,Reflect]
+---*/
+
+const other = $262.createRealm().global;
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "leftContext", other.RegExp);
+ },
+ "RegExp.leftContext getter throws for cross-realm receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "$`", other.RegExp);
+ },
+ "RegExp.$` getter throws for cross-realm receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-not-regexp-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-not-regexp-constructor.js
new file mode 100644
index 0000000000..a25bd49cad
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-not-regexp-constructor.js
@@ -0,0 +1,62 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.leftContext throws a TypeError for non-%RegExp% receiver
+info: |
+ get RegExp.leftContext
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLeftContext]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp]
+---*/
+
+["leftContext", "$`"].forEach(function (property) {
+ const desc = Object.getOwnPropertyDescriptor(RegExp, property);
+
+ // Similar to the other test verifying the descriptor, but split as properties can be removed or changed
+ assert.sameValue(typeof desc.get, "function", property + " getter");
+
+ // If SameValue(C, thisValue) is false, throw a TypeError exception.
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get();
+ },
+ "RegExp." + property + " getter throws for property descriptor receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(/ /);
+ },
+ "RegExp." + property + " getter throws for RegExp instance receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(RegExp.prototype);
+ },
+ "RegExp." + property + " getter throws for %RegExp.prototype% receiver"
+ );
+
+ [undefined, null, {}, true, false, 0, 1, "string"].forEach(function (value) {
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(value);
+ },
+ "RegExp." + property + ' getter throws for primitive "' + value + '" receiver'
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-subclass-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-subclass-constructor.js
new file mode 100644
index 0000000000..7eba961283
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-subclass-constructor.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.leftContext throws a TypeError for subclass receiver
+info: |
+ get RegExp.leftContext
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLeftContext]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,class]
+---*/
+
+class MyRegExp extends RegExp {}
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp.leftContext;
+ },
+ "RegExp.leftContext getter throws for subclass receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp["$`"];
+ },
+ "RegExp.$` getter throws for subclass receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js
new file mode 100644
index 0000000000..748a09a522
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js
@@ -0,0 +1,42 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Property descriptor for RegExp.rightContext
+info: |
+ RegExp.rightContext is an accessor property with attributes:
+ {
+ [[Enumerable]]: false,
+ [[Configurable]]: true,
+ [[Set]]: undefined,
+ }
+
+ get RegExp.rightContext
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpRightContext]]).
+includes: [propertyHelper.js]
+features: [legacy-regexp]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(RegExp, "rightContext");
+
+assert.sameValue(desc.set, undefined, "`set` property");
+assert.sameValue(typeof desc.get, "function", "`get` property");
+
+verifyProperty(RegExp, "rightContext", {
+ enumerable: false,
+ configurable: true
+});
+
+desc = Object.getOwnPropertyDescriptor(RegExp, "$'");
+
+assert.sameValue(desc.set, undefined, "`set` property");
+assert.sameValue(typeof desc.get, "function", "`get` property");
+
+verifyProperty(RegExp, "$'", {
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-cross-realm-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-cross-realm-constructor.js
new file mode 100644
index 0000000000..321f8d6707
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-cross-realm-constructor.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.rightContext throws a TypeError for cross-realm receiver
+info: |
+ get RegExp.rightContext
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpRightContext]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,cross-realm,Reflect]
+---*/
+
+const other = $262.createRealm().global;
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "rightContext", other.RegExp);
+ },
+ "RegExp.rightContext getter throws for cross-realm receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ Reflect.get(RegExp, "$'", other.RegExp);
+ },
+ "RegExp.$' getter throws for cross-realm receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-not-regexp-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-not-regexp-constructor.js
new file mode 100644
index 0000000000..01b5c065c9
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-not-regexp-constructor.js
@@ -0,0 +1,62 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.rightContext throws a TypeError for non-%RegExp% receiver
+info: |
+ get RegExp.rightContext
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpRightContext]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp]
+---*/
+
+["rightContext", "$'"].forEach(function (property) {
+ const desc = Object.getOwnPropertyDescriptor(RegExp, property);
+
+ // Similar to the other test verifying the descriptor, but split as properties can be removed or changed
+ assert.sameValue(typeof desc.get, "function", property + " getter");
+
+ // If SameValue(C, thisValue) is false, throw a TypeError exception.
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get();
+ },
+ "RegExp." + property + " getter throws for property descriptor receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(/ /);
+ },
+ "RegExp." + property + " getter throws for RegExp instance receiver"
+ );
+
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(RegExp.prototype);
+ },
+ "RegExp." + property + " getter throws for %RegExp.prototype% receiver"
+ );
+
+ [undefined, null, {}, true, false, 0, 1, "string"].forEach(function (value) {
+ assert.throws(
+ TypeError,
+ function () {
+ desc.get.call(value);
+ },
+ "RegExp." + property + ' getter throws for primitive "' + value + '" receiver'
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-subclass-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-subclass-constructor.js
new file mode 100644
index 0000000000..4dbc82e23c
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-subclass-constructor.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: RegExp.rightContext throws a TypeError for subclass receiver
+info: |
+ get RegExp.rightContext
+
+ 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpRightContext]]).
+
+ GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
+
+ 1. Assert C is an object that has an internal slot named internalSlotName.
+ 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
+ 3. ...
+features: [legacy-regexp,class]
+---*/
+
+class MyRegExp extends RegExp {}
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp.rightContext;
+ },
+ "RegExp.rightContext getter throws for subclass receiver"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ MyRegExp["$'"];
+ },
+ "RegExp.$' getter throws for subclass receiver"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/non-unicode-malformed-lookbehind.js b/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/non-unicode-malformed-lookbehind.js
new file mode 100644
index 0000000000..9c8ab7ba6b
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/non-unicode-malformed-lookbehind.js
@@ -0,0 +1,17 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-GroupSpecifier
+description: >
+ \k is parsed as IdentityEscape as look-behind assertion is not a GroupName.
+features: [regexp-named-groups, regexp-lookbehind]
+---*/
+
+assert(/\k<a>(?<=>)a/.test("k<a>a"));
+assert(/(?<=>)\k<a>/.test(">k<a>"));
+
+assert(/\k<a>(?<!a)a/.test("k<a>a"));
+assert(/(?<!a>)\k<a>/.test("k<a>"));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/non-unicode-malformed.js b/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/non-unicode-malformed.js
new file mode 100644
index 0000000000..b7dd55db09
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/non-unicode-malformed.js
@@ -0,0 +1,27 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Named groups in Unicode RegExps have some syntax errors and some
+ compatibility escape fallback behavior.
+esid: prod-GroupSpecifier
+features: [regexp-named-groups]
+includes: [compareArray.js]
+---*/
+
+assert(/\k<a>/.test("k<a>"));
+assert(/\k<4>/.test("k<4>"));
+assert(/\k<a/.test("k<a"));
+assert(/\k/.test("k"));
+
+assert(/(?<a>\a)/.test("a"));
+
+assert.compareArray(["k<a>"], "xxxk<a>xxx".match(/\k<a>/));
+assert.compareArray(["k<a"], "xxxk<a>xxx".match(/\k<a/));
+
+assert(/\k<a>(<a>x)/.test("k<a><a>x"));
+assert(/\k<a>\1/.test("k<a>\x01"));
+assert(/\1(b)\k<a>/.test("bk<a>"));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/named-groups/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/Symbol.match-getter-recompiles-source.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/Symbol.match-getter-recompiles-source.js
new file mode 100644
index 0000000000..41e8cbaf19
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/Symbol.match-getter-recompiles-source.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-regexp.prototype-@@split
+description: >
+ Side-effects in IsRegExp may recompile the regular expression.
+info: |
+ 21.2.5.11 RegExp.prototype [ @@split ] ( string, limit )
+ ...
+ 4. Let C be ? SpeciesConstructor(rx, %RegExp%).
+ ...
+ 10. Let splitter be ? Construct(C, « rx, newFlags »).
+ ...
+
+ 21.2.3.1 RegExp ( pattern, flags )
+ 1. Let patternIsRegExp be ? IsRegExp(pattern).
+ ...
+
+features: [Symbol.match, Symbol.split]
+---*/
+
+var regExp = /a/;
+Object.defineProperty(regExp, Symbol.match, {
+ get: function() {
+ regExp.compile("b");
+ }
+});
+
+var result = regExp[Symbol.split]("abba");
+
+assert.sameValue(result.length, 3);
+assert.sameValue(result[0], "a");
+assert.sameValue(result[1], "");
+assert.sameValue(result[2], "a");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/toint32-limit-recompiles-source.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/toint32-limit-recompiles-source.js
new file mode 100644
index 0000000000..351407cf65
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/Symbol.split/toint32-limit-recompiles-source.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-regexp.prototype-@@split
+description: >
+ Side-effects in ToUint32 may recompile the regular expression.
+info: |
+ 21.2.5.11 RegExp.prototype [ @@split ] ( string, limit )
+ ...
+ 10. Let splitter be ? Construct(C, « rx, newFlags »).
+ ...
+ 13. If limit is undefined, let lim be 2^32-1; else let lim be ? ToUint32(limit).
+ ...
+
+features: [Symbol.split]
+---*/
+
+var regExp = /a/;
+var limit = {
+ valueOf: function() {
+ regExp.compile("b");
+ return -1;
+ }
+};
+
+var result = regExp[Symbol.split]("abba", limit);
+
+assert.sameValue(result.length, 3);
+assert.sameValue(result[0], "");
+assert.sameValue(result[1], "bb");
+assert.sameValue(result[2], "");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/B.RegExp.prototype.compile.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/B.RegExp.prototype.compile.js
new file mode 100644
index 0000000000..52b6cfa331
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/B.RegExp.prototype.compile.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: B.2.5.1
+description: >
+ Object.getOwnPropertyDescriptor returns data desc for functions on
+ built-ins (RegExp.prototype.compile)
+includes: [propertyHelper.js]
+---*/
+
+verifyProperty(RegExp.prototype, "compile", {
+ enumerable: false,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/duplicate-named-capturing-groups-syntax.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/duplicate-named-capturing-groups-syntax.js
new file mode 100644
index 0000000000..a1ac2676a1
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/duplicate-named-capturing-groups-syntax.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- regexp-duplicate-named-groups is not supported
+// Copyright 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-regexp.prototype.compile
+description: Runtime parsing of syntax for duplicate named capturing groups
+features: [regexp-duplicate-named-groups]
+---*/
+
+let r = /[ab]/;
+
+assert.throws(
+ SyntaxError,
+ () => r.compile("(?<x>a)(?<x>b)"),
+ "Duplicate named capturing groups in the same alternative do not parse"
+);
+
+let source = "(?<x>a)|(?<x>b)";
+r.compile(source);
+assert.sameValue(r.source, source, "Duplicate named capturing groups in separate alternatives parse correctly");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-string-invalid.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-string-invalid.js
new file mode 100644
index 0000000000..a7c8493656
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-string-invalid.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: Behavior when flags is a string describing an invalid flag set
+info: |
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ [...]
+ 3. If flags is undefined, let F be the empty String.
+ 4. Else, let F be ? ToString(flags).
+ 5. If F contains any code unit other than "g", "i", "m", "u", or "y" or if
+ it contains the same code unit more than once, throw a SyntaxError
+ exception.
+---*/
+
+var subject = /abcd/ig;
+
+assert.throws(SyntaxError, function() {
+ subject.compile('', 'igi');
+}, 'invalid flags: igi');
+
+assert.throws(SyntaxError, function() {
+ subject.compile('', 'gI');
+}, 'invalid flags: gI');
+
+assert.throws(SyntaxError, function() {
+ subject.compile('', 'w');
+}, 'invalid flags: w');
+
+assert.sameValue(
+ subject.toString(),
+ new RegExp('abcd', 'ig').toString(),
+ '[[OriginalSource]] internal slot'
+);
+
+assert.sameValue(
+ subject.test('AbCD'), true, '[[RegExpMatcher]] internal slot'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-to-string-err.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-to-string-err.js
new file mode 100644
index 0000000000..1fad177bd1
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-to-string-err.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: Behavior when provided flags cannot be coerced to a string
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ a. If flags is not undefined, throw a TypeError exception.
+ b. Let P be the value of pattern's [[OriginalSource]] internal slot.
+ c. Let F be the value of pattern's [[OriginalFlags]] internal slot.
+ 4. Else,
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ [...]
+ 3. If flags is undefined, let F be the empty String.
+ 4. Else, let F be ? ToString(flags).
+features: [Symbol]
+---*/
+
+var symbol = Symbol('');
+var subject = /./;
+var badToString = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+subject.lastIndex = 99;
+
+assert.throws(Test262Error, function() {
+ /./.compile('', badToString);
+});
+
+assert.throws(TypeError, function() {
+ /./.compile('', symbol);
+});
+
+assert.sameValue(subject.lastIndex, 99);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-to-string.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-to-string.js
new file mode 100644
index 0000000000..7044462a56
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-to-string.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: Behavior when flags is a string describing a valid flag set
+info: |
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ [...]
+ 3. If flags is undefined, let F be the empty String.
+ 4. Else, let F be ? ToString(flags).
+ [...]
+---*/
+
+var subject = /a/g;
+
+subject.compile('a', 'i');
+
+assert.sameValue(
+ subject.flags,
+ new RegExp('a', 'i').flags,
+ '[[OriginalFlags]] internal slot'
+);
+assert.sameValue(
+ subject.test('A'),
+ true,
+ '[[RegExpMatcher]] internal slot (addition of `i` flag)'
+);
+
+subject.lastIndex = 1;
+assert.sameValue(
+ subject.test('A'),
+ true,
+ '[[RegExpMatcher]] internal slot (removal of `g` flag)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-undefined.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-undefined.js
new file mode 100644
index 0000000000..29cb3b3fb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/flags-undefined.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: Behavior when flags is undefined
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ [...]
+ 4. Else,
+ a. Let P be pattern.
+ b. Let F be flags.
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ [...]
+ 3. If flags is undefined, let F be the empty String.
+ [...]
+---*/
+
+var subject, result;
+
+subject = /abc/ig;
+
+result = subject.compile('def');
+
+assert.sameValue(result, subject, 'method return value (unspecified)');
+assert.sameValue(
+ subject.flags, new RegExp('def').flags, '[[OriginalFlags]] (unspecified)'
+);
+assert.sameValue(
+ subject.test('DEF'), false, '[[RegExpMatcher]] internal slot (unspecified)'
+);
+
+subject = /abc/gi;
+
+result = subject.compile('def', undefined);
+
+assert.sameValue(result, subject, 'method return value (explicit undefined)');
+assert.sameValue(
+ subject.flags,
+ new RegExp('def').flags,
+ '[[OriginalSource]] (explicit undefined)'
+);
+assert.sameValue(
+ subject.test('DEF'),
+ false,
+ '[[RegExpMatcher]] internal slot (explicit undefined)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/length.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/length.js
new file mode 100644
index 0000000000..ce648e692c
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/length.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: B.2.5.1
+description: >
+ RegExp.prototype.compile.length is 2.
+info: |
+ RegExp.prototype.compile (pattern, flags )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+verifyProperty(RegExp.prototype.compile, "length", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 2
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/name.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/name.js
new file mode 100644
index 0000000000..2e35d280e3
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/name.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: B.2.5.1
+description: >
+ RegExp.prototype.compile.name is "compile".
+info: |
+ RegExp.prototype.compile (pattern, flags )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+verifyProperty(RegExp.prototype.compile, "name", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: "compile"
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-distinct.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-distinct.js
new file mode 100644
index 0000000000..fed4f82364
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-distinct.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: RegExp is re-initialized when invoked with a distinct instance
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ a. If flags is not undefined, throw a TypeError exception.
+ b. Let P be the value of pattern's [[OriginalSource]] internal slot.
+ c. Let F be the value of pattern's [[OriginalFlags]] internal slot.
+ 4. Else,
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+---*/
+
+var subject = /abc/gim;
+var pattern = /def/;
+var result;
+subject.lastIndex = 23;
+pattern.lastIndex = 45;
+
+result = subject.compile(pattern);
+
+assert.sameValue(result, subject, 'method return value');
+assert.sameValue(subject.lastIndex, 0);
+assert.sameValue(pattern.lastIndex, 45);
+
+assert.sameValue(subject.toString(), new RegExp('def').toString());
+assert.sameValue(
+ subject.test('def'), true, '[[RegExpMatcher]] internal slot (source)'
+);
+assert.sameValue(
+ subject.test('DEF'), false, '[[RegExpMatch]] internal slot (flags)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-flags-defined.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-flags-defined.js
new file mode 100644
index 0000000000..6ea536960c
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-flags-defined.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: >
+ Behavior when provided pattern is a RegExp instance and flags are specified
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ a. If flags is not undefined, throw a TypeError exception.
+---*/
+
+var re = /./;
+re.lastIndex = 23;
+
+assert.sameValue(typeof RegExp.prototype.compile, 'function');
+
+assert.throws(TypeError, function() {
+ re.compile(re, null);
+}, 'null');
+
+assert.throws(TypeError, function() {
+ re.compile(re, 0);
+}, 'numeric primitive');
+
+assert.throws(TypeError, function() {
+ re.compile(re, '');
+}, 'string primitive');
+
+assert.throws(TypeError, function() {
+ re.compile(re, false);
+}, 'boolean primitive');
+
+assert.throws(TypeError, function() {
+ re.compile(re, {});
+}, 'ordinary object');
+
+assert.throws(TypeError, function() {
+ re.compile(re, []);
+}, 'array exotic object');
+
+assert.sameValue(re.lastIndex, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-immutable-lastindex.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-immutable-lastindex.js
new file mode 100644
index 0000000000..cb69aaa439
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-immutable-lastindex.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: Behavior when `lastIndex` property of "this" value is non-writable
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ a. If flags is not undefined, throw a TypeError exception.
+ b. Let P be the value of pattern's [[OriginalSource]] internal slot.
+ c. Let F be the value of pattern's [[OriginalFlags]] internal slot.
+ 4. Else,
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ [...]
+ 12. Perform ? Set(obj, "lastIndex", 0, true).
+---*/
+
+var subject = /initial/;
+Object.defineProperty(subject, 'lastIndex', { value: 45, writable: false });
+
+assert.throws(TypeError, function() {
+ subject.compile(/updated/gi);
+});
+
+assert.sameValue(
+ subject.toString(),
+ new RegExp('updated', 'gi').toString(),
+ '[[OriginalSource]] internal slot'
+);
+assert.sameValue(subject.lastIndex, 45);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-props.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-props.js
new file mode 100644
index 0000000000..f723c00174
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-props.js
@@ -0,0 +1,75 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: >
+ Properties are not referenced when provided pattern is a RegExp instance
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ a. If flags is not undefined, throw a TypeError exception.
+ b. Let P be the value of pattern's [[OriginalSource]] internal slot.
+ c. Let F be the value of pattern's [[OriginalFlags]] internal slot.
+ 4. Else,
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+---*/
+
+var thisValue = /abc/gim;
+var pattern = /def/mig;
+var flagsCount = 0;
+var globalCount = 0;
+var ignoreCaseCount = 0;
+var multilineCount = 0;
+var stickyCount = 0;
+var unicodeCount = 0;
+var counters = {
+ flags: {
+ get: function() {
+ flagsCount += 1;
+ }
+ },
+ global: {
+ get: function() {
+ globalCount += 1;
+ }
+ },
+ ignoreCase: {
+ get: function() {
+ ignoreCaseCount += 1;
+ }
+ },
+ multiline: {
+ get: function() {
+ multilineCount += 1;
+ }
+ },
+ sticky: {
+ get: function() {
+ stickyCount += 1;
+ }
+ },
+ unicode: {
+ get: function() {
+ unicodeCount += 1;
+ }
+ }
+};
+
+Object.defineProperties(thisValue, counters);
+Object.defineProperties(pattern, counters);
+
+thisValue.compile(thisValue);
+thisValue.compile(pattern);
+thisValue.compile(thisValue);
+
+assert.sameValue(flagsCount, 0, '`flags` property not accessed');
+assert.sameValue(globalCount, 0, '`global` property not accessed');
+assert.sameValue(ignoreCaseCount, 0, '`ignoreCase` property not accessed');
+assert.sameValue(multilineCount, 0, '`multiline` property not accessed');
+assert.sameValue(stickyCount, 0, '`sticky` property not accessed');
+assert.sameValue(unicodeCount, 0, '`unicode` property not accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-same.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-same.js
new file mode 100644
index 0000000000..b239e0e48b
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-regexp-same.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: RegExp is re-initialized when invoked with the same instance
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ a. If flags is not undefined, throw a TypeError exception.
+ b. Let P be the value of pattern's [[OriginalSource]] internal slot.
+ c. Let F be the value of pattern's [[OriginalFlags]] internal slot.
+ 4. Else,
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+---*/
+
+var subject = /abc/gim;
+var result;
+subject.lastIndex = 23;
+
+result = subject.compile(subject);
+
+assert.sameValue(result, subject, 'method return value');
+assert.sameValue(
+ subject.toString(),
+ new RegExp('abc', 'gim').toString(),
+ '[[OriginalSource]] internal slot'
+);
+assert.sameValue(subject.lastIndex, 0);
+assert.sameValue(subject.test('aBc'), true, '[[RegExpMatcher]] internal slot');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid-u.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid-u.js
new file mode 100644
index 0000000000..d0c3cd6d5f
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid-u.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: >
+ Behavior when pattern is a string describing an invalid pattern (unicode)
+info: |
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ 6. If F contains "u", let BMP be false; else let BMP be true.
+ 7. If BMP is true, then
+ a. Parse P using the grammars in 21.2.1 and interpreting each of its
+ 16-bit elements as a Unicode BMP code point. UTF-16 decoding is not
+ applied to the elements. The goal symbol for the parse is Pattern.
+ Throw a SyntaxError exception if P did not conform to the grammar, if
+ any elements of P were not matched by the parse, or if any Early
+ Error conditions exist.
+ [...]
+---*/
+
+var subject = /test262/ig;
+
+assert.throws(SyntaxError, function() {
+ subject.compile('{', 'u');
+}, 'invalid pattern: {');
+
+assert.throws(SyntaxError, function() {
+ subject.compile('\\2', 'u');
+}, 'invalid pattern: \\2');
+
+assert.sameValue(
+ subject.toString(),
+ new RegExp('test262', 'ig').toString(),
+ '[[OriginalSource]] internal slot'
+);
+assert.sameValue(
+ subject.test('tEsT262'), true, '[[RegExpMatcher]] internal slot'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid.js
new file mode 100644
index 0000000000..471e8da688
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: >
+ Behavior when pattern is a string describing an invalid pattern
+ (non-unicode)
+info: |
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ 6. If F contains "u", let BMP be false; else let BMP be true.
+ 7. If BMP is true, then
+ [...]
+ 8. Else,
+ a. Parse P using the grammars in 21.2.1 and interpreting P as UTF-16
+ encoded Unicode code points (6.1.4). The goal symbol for the parse is
+ Pattern[U]. Throw a SyntaxError exception if P did not conform to the
+ grammar, if any elements of P were not matched by the parse, or if
+ any Early Error conditions exist.
+---*/
+
+var subject = /test262/ig;
+
+assert.throws(SyntaxError, function() {
+ subject.compile('?');
+}, 'invalid pattern: ?');
+
+assert.throws(SyntaxError, function() {
+ subject.compile('.{2,1}');
+}, 'invalid pattern: .{2,1}');
+
+assert.sameValue(
+ subject.toString(),
+ new RegExp('test262', 'ig').toString(),
+ '[[OriginalSource]] internal slot'
+);
+
+assert.sameValue(
+ subject.test('TEsT262'), true, '[[RegExpMatcher]] internal slot'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-u.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-u.js
new file mode 100644
index 0000000000..e3840230fb
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string-u.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: >
+ Behavior when pattern is a string describing a valid pattern (unicode)
+info: |
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ 6. If F contains "u", let BMP be false; else let BMP be true.
+ 7. If BMP is true, then
+ a. Parse P using the grammars in 21.2.1 and interpreting each of its
+ 16-bit elements as a Unicode BMP code point. UTF-16 decoding is not
+ applied to the elements. The goal symbol for the parse is Pattern.
+ Throw a SyntaxError exception if P did not conform to the grammar, if
+ any elements of P were not matched by the parse, or if any Early
+ Error conditions exist.
+ b. Let patternCharacters be a List whose elements are the code unit
+ elements of P.
+ [...]
+---*/
+
+var subject = /original value/ig;
+
+subject.compile('[\ud834\udf06]', 'u');
+
+assert.sameValue(
+ subject.source,
+ new RegExp('[\ud834\udf06]', 'u').source,
+ '[[OriginalSource]] internal slot'
+);
+assert.sameValue(
+ subject.test('original value'),
+ false,
+ '[[RegExpMatcher]] internal slot (source)'
+);
+assert.sameValue(
+ subject.test('\ud834'), false, '[[RegExpMatcher]] internal slot (flags #1)'
+);
+assert.sameValue(
+ subject.test('\udf06'), false, '[[RegExpMatcher]] internal slot (flags #2)'
+);
+assert.sameValue(
+ subject.test('\ud834\udf06'),
+ true,
+ '[[RegExpMatcher]] internal slot (flags #3)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string.js
new file mode 100644
index 0000000000..57c9a82e41
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-string.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: >
+ Behavior when pattern is a string describing a valid pattern (non-unicode)
+info: |
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ 6. If F contains "u", let BMP be false; else let BMP be true.
+ 7. If BMP is true, then
+ [...]
+ 8. Else,
+ a. Parse P using the grammars in 21.2.1 and interpreting P as UTF-16
+ encoded Unicode code points (6.1.4). The goal symbol for the parse is
+ Pattern[U]. Throw a SyntaxError exception if P did not conform to the
+ grammar, if any elements of P were not matched by the parse, or if
+ any Early Error conditions exist.
+ b. Let patternCharacters be a List whose elements are the code points
+ resulting from applying UTF-16 decoding to P's sequence of elements.
+ [...]
+---*/
+
+var subject = /original value/ig;
+
+subject.compile('new value');
+
+assert.sameValue(
+ subject.source,
+ new RegExp('new value').source,
+ '[[OriginalSource]] internal slot'
+);
+assert.sameValue(
+ subject.test('original value'), false, '[[RegExpMatcher]] internal slot'
+);
+assert.sameValue(
+ subject.test('new value'), true, '[[RegExpMatcher]] internal slot'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-to-string-err.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-to-string-err.js
new file mode 100644
index 0000000000..64df03654a
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-to-string-err.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: Behavior when provided pattern cannot be coerced to a string
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ a. If flags is not undefined, throw a TypeError exception.
+ b. Let P be the value of pattern's [[OriginalSource]] internal slot.
+ c. Let F be the value of pattern's [[OriginalFlags]] internal slot.
+ 4. Else,
+ [...]
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ 1. If pattern is undefined, let P be the empty String.
+ 2. Else, let P be ? ToString(pattern).
+features: [Symbol]
+---*/
+
+var symbol = Symbol('');
+var subject = /./;
+var badToString = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+subject.lastIndex = 99;
+
+assert.throws(Test262Error, function() {
+ /./.compile(badToString);
+});
+
+assert.throws(TypeError, function() {
+ /./.compile(symbol);
+});
+
+assert.sameValue(subject.lastIndex, 99);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-undefined.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-undefined.js
new file mode 100644
index 0000000000..52328d262d
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/pattern-undefined.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: Behavior when pattern is undefined
+info: |
+ [...]
+ 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal
+ slot, then
+ [...]
+ 4. Else,
+ a. Let P be pattern.
+ b. Let F be flags.
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.3.2.2 Runtime Semantics: RegExpInitialize
+
+ 1. If pattern is undefined, let P be the empty String.
+ [...]
+---*/
+
+var subject;
+
+subject = /abc/;
+assert.sameValue(
+ subject.compile(), subject, 'method return value (unspecified)'
+);
+assert.sameValue(
+ subject.source, new RegExp('').source, '[[OriginalSource]] (unspecified)'
+);
+assert.sameValue(
+ subject.test(''), true, '[[RegExpMatcher]] internal slot (unspecified)'
+);
+
+subject = /abc/;
+assert.sameValue(
+ subject.compile(undefined),
+ subject,
+ 'method return value (explicit undefined)'
+);
+assert.sameValue(
+ subject.source,
+ new RegExp('').source,
+ '[[OriginalSource]] (explicit undefined)'
+);
+assert.sameValue(
+ subject.test(''),
+ true,
+ '[[RegExpMatcher]] internal slot (explicit undefined)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-cross-realm-instance.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-cross-realm-instance.js
new file mode 100644
index 0000000000..5c4f9a8234
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-cross-realm-instance.js
@@ -0,0 +1,37 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+description: RegExp.prototype.compile throws a TypeError for cross-realm calls
+features: [legacy-regexp,cross-realm]
+---*/
+
+const other = $262.createRealm().global;
+
+const regexp = new RegExp("");
+const otherRealm_regexp = new other.RegExp("");
+
+assert.throws(
+ TypeError,
+ function () {
+ RegExp.prototype.compile.call(otherRealm_regexp);
+ },
+ "`RegExp.prototype.compile.call(otherRealm_regexp)` throws TypeError"
+);
+
+assert.throws(
+ other.TypeError,
+ function () {
+ other.RegExp.prototype.compile.call(regexp);
+ },
+ "`other.RegExp.prototype.compile.call(regexp)` throws TypeError"
+);
+
+assert.sameValue(
+ otherRealm_regexp.compile(),
+ otherRealm_regexp,
+ "`otherRealm_regexp.compile()` is SameValue with `otherRealm_regexp`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-not-object.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-not-object.js
new file mode 100644
index 0000000000..77424a0062
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-not-object.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: Behavior when "this" value is not an Object
+info: |
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object or Type(O) is Object and O does not have a
+ [[RegExpMatcher]] internal slot, then
+ a. Throw a TypeError exception.
+features: [Symbol]
+---*/
+
+var compile = RegExp.prototype.compile;
+var symbol = Symbol('');
+
+assert.sameValue(typeof compile, 'function');
+
+assert.throws(TypeError, function() {
+ compile.call(undefined);
+}, 'undefined');
+
+assert.throws(TypeError, function() {
+ compile.call(null);
+}, 'null');
+
+assert.throws(TypeError, function() {
+ compile.call(23);
+}, 'number');
+
+assert.throws(TypeError, function() {
+ compile.call(true);
+}, 'boolean');
+
+assert.throws(TypeError, function() {
+ compile.call('/string/');
+}, 'string');
+
+assert.throws(TypeError, function() {
+ compile.call(symbol);
+}, 'symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-obj-not-regexp.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-obj-not-regexp.js
new file mode 100644
index 0000000000..785fccacff
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-obj-not-regexp.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+es6id: B.2.5.1
+description: >
+ Behavior when "this" value is an Object without a [[RegExpMatcher]]
+ internal slot
+info: |
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object or Type(O) is Object and O does not have a
+ [[RegExpMatcher]] internal slot, then
+ a. Throw a TypeError exception.
+---*/
+
+var compile = RegExp.prototype.compile;
+
+assert.sameValue(typeof compile, 'function');
+
+assert.throws(TypeError, function() {
+ compile.call({});
+}, 'ordinary object');
+
+assert.throws(TypeError, function() {
+ compile.call([]);
+}, 'array exotic object');
+
+assert.throws(TypeError, function() {
+ compile.call(arguments);
+}, 'arguments exotic object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js
new file mode 100644
index 0000000000..66f6e3f5a6
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- legacy-regexp is not supported
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regexp.prototype.compile
+description: RegExp.prototype.compile throws a TypeError for calls on subclasses
+features: [legacy-regexp,class]
+---*/
+
+const subclass_regexp = new (class extends RegExp {})("");
+
+assert.throws(
+ TypeError,
+ function () {
+ subclass_regexp.compile();
+ },
+ "`subclass_regexp.compile()` throws TypeError"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ RegExp.prototype.compile.call(subclass_regexp);
+ },
+ "`RegExp.prototype.compile.call(subclass_regexp)` throws TypeError"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/browser.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/browser.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/order-after-compile.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/order-after-compile.js
new file mode 100644
index 0000000000..c445800923
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/order-after-compile.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-get-regexp.prototype.flags
+description: >
+ The flags come in the same order in a new instance produced by RegExp.prototype.compile
+info: |
+ B.2.5.1 RegExp.prototype.compile ( pattern, flags )
+
+ ...
+ 5. Return ? RegExpInitialize(O, P, F).
+
+ 21.2.5.3 get RegExp.prototype.flags
+
+ ...
+ 4. Let global be ToBoolean(? Get(R, "global")).
+ 5. If global is true, append "g" as the last code unit of result.
+ 6. Let ignoreCase be ToBoolean(? Get(R, "ignoreCase")).
+ 7. If ignoreCase is true, append "i" as the last code unit of result.
+ 8. Let multiline be ToBoolean(? Get(R, "multiline")).
+ 9. If multiline is true, append "m" as the last code unit of result.
+ 10. Let dotAll be ToBoolean(? Get(R, "dotAll")).
+ 11. If dotAll is true, append "s" as the last code unit of result.
+ 12. Let unicode be ToBoolean(? Get(R, "unicode")).
+ 13. If unicode is true, append "u" as the last code unit of result.
+ 14. Let sticky be ToBoolean(? Get(R, "sticky")).
+ 15. If sticky is true, append "y" as the last code unit of result.
+ 14. Return result.
+features: [regexp-dotall]
+---*/
+
+let re = /(?:)/;
+re.compile("(?:)", "imsuyg");
+assert.sameValue(re.flags, "gimsuy");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/flags/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/prototype/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/prototype/shell.js
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/shell.js b/js/src/tests/test262/annexB/built-ins/RegExp/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/RegExp/shell.js