summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/internals
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/built-ins/Object/internals
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/built-ins/Object/internals')
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-arguments.js35
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-caller.js39
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js32
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-writable-regexp-dollar1.js26
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/nan-equivalence-define-own-property-reassign.js70
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/nan-equivalence-define-own-property-reconfigure.js77
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/shell.js24
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Object/internals/shell.js0
10 files changed, 303 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/browser.js b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/browser.js
diff --git a/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-arguments.js b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-arguments.js
new file mode 100644
index 0000000000..4497384698
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-arguments.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2017 Claude Pache. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-invariants-of-the-essential-internal-methods
+description: >
+ Value of non-writable, non-configurable data property must not change
+ ("arguments" property of a non-strict function)
+info: |
+ [[GetOwnProperty]] (P)
+ [...]
+ - If a property P is described as a data property with Desc.[[Value]] equal
+ to v and Desc.[[Writable]] and Desc.[[Configurable]] are both false, then
+ the SameValue must be returned for the Desc.[[Value]] attribute of the
+ property on all future calls to [[GetOwnProperty]] ( P ).
+ [...]
+ (This invariant was violated for the specific property under test by a number
+ of implementations as of January 2017.)
+---*/
+
+function f() {
+ return Reflect.getOwnPropertyDescriptor(f, 'arguments');
+}
+
+Reflect.defineProperty(f, 'arguments', {
+ writable: false,
+ configurable: false
+});
+
+var desc = Reflect.getOwnPropertyDescriptor(f, 'arguments');
+if (desc && desc.configurable === false && desc.writable === false) {
+ var desc2 = f();
+ assert.sameValue(desc.value, desc2.value);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-caller.js b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-caller.js
new file mode 100644
index 0000000000..fe7c73ee9a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-caller.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 Claude Pache. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-invariants-of-the-essential-internal-methods
+description: >
+ Value of non-writable, non-configurable data property must not change
+ ("caller" property of a non-strict function)
+info: |
+ [[GetOwnProperty]] (P)
+ [...]
+ - If a property P is described as a data property with Desc.[[Value]] equal
+ to v and Desc.[[Writable]] and Desc.[[Configurable]] are both false, then
+ the SameValue must be returned for the Desc.[[Value]] attribute of the
+ property on all future calls to [[GetOwnProperty]] ( P ).
+ [...]
+ (This invariant was violated for the specific property under test by a number
+ of implementations as of January 2017.)
+---*/
+
+function f() {
+ return Reflect.getOwnPropertyDescriptor(f, 'caller');
+}
+
+function g() {
+ return f();
+}
+
+Reflect.defineProperty(f, 'caller', {
+ writable: false,
+ configurable: false
+});
+
+var desc = Reflect.getOwnPropertyDescriptor(f, 'caller');
+if (desc && desc.configurable === false && desc.writable === false) {
+ var desc2 = g();
+ assert.sameValue(desc.value, desc2.value);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js
new file mode 100644
index 0000000000..7c1e48dc00
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2017 Claude Pache. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-invariants-of-the-essential-internal-methods
+description: >
+ Value of non-writable, non-configurable data property must not change
+ ("$1" property of the RegExp built-in)
+info: |
+ [[GetOwnProperty]] (P)
+ [...]
+ - If a property P is described as a data property with Desc.[[Value]] equal
+ to v and Desc.[[Writable]] and Desc.[[Configurable]] are both false, then
+ the SameValue must be returned for the Desc.[[Value]] attribute of the
+ property on all future calls to [[GetOwnProperty]] ( P ).
+ [...]
+ (This invariant was violated for the specific property under test by at least
+ one implementation as of January 2017.)
+---*/
+
+Reflect.defineProperty(RegExp, '$1', {
+ writable: false,
+ configurable: false
+});
+
+var desc = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
+if (desc && desc.configurable === false && desc.writable === false) {
+ /(x)/.exec('x');
+ var desc2 = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
+ assert.sameValue(desc.value, desc2.value);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-writable-regexp-dollar1.js b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-writable-regexp-dollar1.js
new file mode 100644
index 0000000000..374c4a48df
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-writable-regexp-dollar1.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 Claude Pache. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-invariants-of-the-essential-internal-methods
+description: >
+ A property made non-writable, non-configurable must not be reported as writable
+ ("$1" property of the RegExp built-in)
+info: |
+ [[GetOwnProperty]] (P)
+ [...]
+ - If the [[Writable]] attribute may change from false to true,
+ then the [[Configurable]] attribute must be true..
+ [...]
+ (This invariant was violated for the specific property under test by at least
+ one implementation as of January 2017.)
+---*/
+
+if (Reflect.defineProperty(RegExp, '$1', {
+ writable: false,
+ configurable: false
+ })) {
+ var desc = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
+ assert.sameValue(desc.writable, false);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/nan-equivalence-define-own-property-reassign.js b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/nan-equivalence-define-own-property-reassign.js
new file mode 100644
index 0000000000..367b86a20d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/nan-equivalence-define-own-property-reassign.js
@@ -0,0 +1,70 @@
+// 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-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
+description: >
+ Replaces value field even if they pass in the SameValue algorithm, including
+ distinct NaN values
+info: |
+ This test does not compare the actual byte values, instead it simply checks that
+ the value is some valid NaN encoding.
+
+ ---
+
+ Previously, this test compared the "value" field using the SameValue
+ algorithm (thereby ignoring distinct NaN values)
+
+ ---
+
+ [[DefineOwnProperty]] (P, Desc)
+
+ Return ? OrdinaryDefineOwnProperty(O, P, Desc).
+
+ #sec-ordinarydefineownproperty
+ OrdinaryDefineOwnProperty ( O, P, Desc )
+
+ 1. Let current be ? O.[[GetOwnProperty]](P).
+ 2. Let extensible be O.[[Extensible]].
+ 3. Return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc,
+ current).
+
+ #sec-validateandapplypropertydescriptor
+ ValidateAndApplyPropertyDescriptor ( O, P, extensible, Desc, current )
+
+ ...
+ 7. Else if IsDataDescriptor(current) and IsDataDescriptor(Desc) are both true,
+ then
+ a. If current.[[Configurable]] is false and current.[[Writable]] is false,
+ then
+ ...
+ ...
+ 9. If O is not undefined, then
+ a. For each field of Desc that is present, set the corresponding attribute
+ of the property named P of object O to the value of the field.
+ 10. Return true.
+
+ #sec-isnan-number
+
+ NOTE: A reliable way for ECMAScript code to test if a value X is a NaN is
+ an expression of the form X !== X. The result will be true if and only
+ if X is a NaN.
+includes: [nans.js]
+---*/
+
+var len = NaNs.length;
+
+for (var idx = 0; idx < len; ++idx) {
+ for (var jdx = 0; jdx < len; ++jdx) {
+ var a = {};
+
+ a.prop = NaNs[idx];
+ a.prop = NaNs[jdx];
+
+ assert(
+ a.prop !== a.prop,
+ `Object property value reassigned to NaN produced by (index=${idx}) results in a valid NaN`
+ );
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/nan-equivalence-define-own-property-reconfigure.js b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/nan-equivalence-define-own-property-reconfigure.js
new file mode 100644
index 0000000000..4c10cb6f8f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/nan-equivalence-define-own-property-reconfigure.js
@@ -0,0 +1,77 @@
+// 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-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
+description: >
+ Replaces value field even if they pass in the SameValue algorithm, including
+ distinct NaN values
+info: |
+ This test does not compare the actual byte values, instead it simply checks that
+ the value is some valid NaN encoding.
+
+ ---
+
+ Previously, this method compared the "value" field using the SameValue
+ algorithm (thereby ignoring distinct NaN values)
+
+ ---
+
+ [[DefineOwnProperty]] (P, Desc)
+
+ Return ? OrdinaryDefineOwnProperty(O, P, Desc).
+
+ #sec-ordinarydefineownproperty
+ OrdinaryDefineOwnProperty ( O, P, Desc )
+
+ 1. Let current be ? O.[[GetOwnProperty]](P).
+ 2. Let extensible be O.[[Extensible]].
+ 3. Return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc,
+ current).
+
+ #sec-validateandapplypropertydescriptor
+ ValidateAndApplyPropertyDescriptor ( O, P, extensible, Desc, current )
+
+ ...
+ 7. Else if IsDataDescriptor(current) and IsDataDescriptor(Desc) are both true,
+ then
+ a. If current.[[Configurable]] is false and current.[[Writable]] is false,
+ then
+ ...
+ ...
+ 9. If O is not undefined, then
+ a. For each field of Desc that is present, set the corresponding attribute
+ of the property named P of object O to the value of the field.
+ 10. Return true.
+
+ #sec-isnan-number
+
+ NOTE: A reliable way for ECMAScript code to test if a value X is a NaN is
+ an expression of the form X !== X. The result will be true if and only
+ if X is a NaN.
+includes: [nans.js]
+---*/
+
+var len = NaNs.length;
+
+for (var idx = 0; idx < len; ++idx) {
+ for (var jdx = 0; jdx < len; ++jdx) {
+ var a = {};
+ var b = {};
+
+ Object.defineProperty(a, "prop", {
+ value: NaNs[idx],
+ configurable: true,
+ });
+
+ Object.defineProperty(a, "prop", {
+ value: NaNs[jdx],
+ });
+
+ assert(
+ a.prop !== a.prop,
+ `Object property value reconfigured to NaN produced by (index=${idx}) results in a valid NaN`
+ );
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/shell.js b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/shell.js
new file mode 100644
index 0000000000..b9f0067942
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/shell.js
@@ -0,0 +1,24 @@
+// GENERATED, DO NOT EDIT
+// file: nans.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ A collection of NaN values produced from expressions that have been observed
+ to create distinct bit representations on various platforms. These provide a
+ weak basis for assertions regarding the consistent canonicalization of NaN
+ values in Array buffers.
+defines: [NaNs]
+---*/
+
+var NaNs = [
+ NaN,
+ Number.NaN,
+ NaN * 0,
+ 0/0,
+ Infinity/Infinity,
+ -(0/0),
+ Math.pow(-1, 0.5),
+ -Math.pow(-1, 0.5),
+ Number("Not-a-Number"),
+];
diff --git a/js/src/tests/test262/built-ins/Object/internals/browser.js b/js/src/tests/test262/built-ins/Object/internals/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/browser.js
diff --git a/js/src/tests/test262/built-ins/Object/internals/shell.js b/js/src/tests/test262/built-ins/Object/internals/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/internals/shell.js