summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index')
-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
6 files changed, 164 insertions, 0 deletions
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);