summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/arguments-object/mapped
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/arguments-object/mapped')
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/Symbol.iterator.js22
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/browser.js0
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/enumerable-configurable-accessor-descriptor.js46
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js19
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js21
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js21
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js21
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js21
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js26
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js27
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js27
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js26
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js27
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js30
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js27
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js28
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js23
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js28
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js29
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js28
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js27
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js28
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js27
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js28
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js25
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-define-failure.js45
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js31
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js31
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js29
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js30
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js42
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js41
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js31
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js39
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js44
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js41
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js42
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js44
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js32
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js40
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js39
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js29
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js40
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/shell.js0
-rw-r--r--js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js47
45 files changed, 1349 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/arguments-object/mapped/Symbol.iterator.js b/js/src/tests/test262/language/arguments-object/mapped/Symbol.iterator.js
new file mode 100644
index 0000000000..72d0534c36
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/Symbol.iterator.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.4.4.7 S22
+description: >
+ Mapped arguments exotic objects should implement the Array iterator
+ protocol.
+includes: [propertyHelper.js]
+flags: [noStrict]
+features: [Symbol.iterator]
+---*/
+
+(function() {
+ verifyProperty(arguments, Symbol.iterator, {
+ value: [][Symbol.iterator],
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ });
+}());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/browser.js b/js/src/tests/test262/language/arguments-object/mapped/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/browser.js
diff --git a/js/src/tests/test262/language/arguments-object/mapped/enumerable-configurable-accessor-descriptor.js b/js/src/tests/test262/language/arguments-object/mapped/enumerable-configurable-accessor-descriptor.js
new file mode 100644
index 0000000000..bb2a5cb390
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/enumerable-configurable-accessor-descriptor.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+description: >
+ Index gets unmapped when redefined with accessor. Unmapped index is created.
+info: |
+ [[DefineOwnProperty]] ( P, Desc )
+
+ [...]
+ 6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc).
+ 7. If allowed is false, return false.
+ 8. If isMapped is true, then
+ a. If IsAccessorDescriptor(Desc) is true, then
+ i. Call map.[[Delete]](P).
+ [...]
+ 9. Return true.
+flags: [noStrict]
+---*/
+
+(function(a) {
+ let setCalls = 0;
+ Object.defineProperty(arguments, "0", {
+ set(_v) { setCalls += 1; },
+ enumerable: true,
+ configurable: true,
+ });
+
+ arguments[0] = "foo";
+
+ assert.sameValue(setCalls, 1);
+ assert.sameValue(a, 0);
+ assert.sameValue(arguments[0], undefined);
+
+
+ Object.defineProperty(arguments, "1", {
+ get: () => "bar",
+ enumerable: true,
+ configurable: true,
+ });
+
+ assert.sameValue(arguments[1], "bar");
+})(0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js
new file mode 100644
index 0000000000..67c909fb28
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped value is not changed when property was made non-configurable.
+flags: [noStrict]
+---*/
+
+function argumentsNonConfigurable(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+}
+argumentsNonConfigurable(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js
new file mode 100644
index 0000000000..12cbcb5170
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, variable is
+ changed with SetMutableBinding.
+flags: [noStrict]
+---*/
+
+function argumentsAndSetMutableBinding(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ a = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndSetMutableBinding(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js
new file mode 100644
index 0000000000..2cedf2ae79
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ is changed with [[DefineOwnProperty]].
+flags: [noStrict]
+---*/
+
+function argumentsAndDefineOwnProperty(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ Object.defineProperty(arguments, "0", {value: 2});
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndDefineOwnProperty(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js
new file mode 100644
index 0000000000..1f26fc78c5
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ is changed with [[Set]].
+flags: [noStrict]
+---*/
+
+function argumentsAndSet(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ arguments[0] = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndSet(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js
new file mode 100644
index 0000000000..ac0eac446e
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ was not deleted. [[Delete]] operation returns false.
+flags: [noStrict]
+---*/
+
+function argumentsAndDelete(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ assert.sameValue(delete arguments[0], false);
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+}
+argumentsAndDelete(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js
new file mode 100644
index 0000000000..f4df9a1c20
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ was not deleted. Variable is changed with SetMutableBinding.
+flags: [noStrict]
+---*/
+
+function argumentsAndDeleteSetMutableBinding(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ // Precondition: Delete is unsuccessful and doesn't affect mapping.
+ assert.sameValue(delete arguments[0], false);
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ a = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndDeleteSetMutableBinding(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js
new file mode 100644
index 0000000000..e1b8775385
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ was not deleted. Arguments property is changed with
+ [[DefineOwnProperty]].
+flags: [noStrict]
+---*/
+
+function argumentsAndDeleteDefineOwnProperty(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ // Precondition: Delete is unsuccessful and doesn't affect mapping.
+ assert.sameValue(delete arguments[0], false);
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ Object.defineProperty(arguments, "0", {value: 2});
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndDeleteDefineOwnProperty(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js
new file mode 100644
index 0000000000..21dfa0d645
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ was not deleted. Arguments property is changed with
+ [[Set]].
+flags: [noStrict]
+---*/
+
+function argumentsAndDeleteSet(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ // Precondition: Delete is unsuccessful and doesn't affect mapping.
+ assert.sameValue(delete arguments[0], false);
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ arguments[0] = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndDeleteSet(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js
new file mode 100644
index 0000000000..2b964aa3db
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-configurable and
+ non-writable. Perform property attribute changes with a single
+ [[DefineOwnProperty]] call. Mapped values are unchanged, mapping
+ itself is removed.
+flags: [noStrict]
+---*/
+
+function argumentsNonConfigurableAndNonWritable(a) {
+ Object.defineProperty(arguments, "0", {configurable: false, writable: false});
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 1);
+}
+argumentsNonConfigurableAndNonWritable(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js
new file mode 100644
index 0000000000..cf93842382
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-configurable and
+ non-writable. Perform property attribute changes with two
+ consecutive [[DefineOwnProperty]] calls. Mapped values are
+ unchanged, mapping itself is removed.
+flags: [noStrict]
+---*/
+
+function argumentsNonConfigurableThenNonWritable(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+ Object.defineProperty(arguments, "0", {writable: false});
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 1);
+}
+argumentsNonConfigurableThenNonWritable(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js
new file mode 100644
index 0000000000..243e8b3958
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-configurable and
+ non-writable. Perform property attribute changes with two
+ [[DefineOwnProperty]] calls. Add intervening call to
+ SetMutableBinding.
+flags: [noStrict]
+---*/
+
+function argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+ a = 2;
+ Object.defineProperty(arguments, "0", {writable: false});
+ assert.sameValue(a, 2);
+ // `arguments[0] === 1` per ES2015, Rev 38, April 14, 2015 Final Draft.
+ // Specification bug: https://bugs.ecmascript.org/show_bug.cgi?id=4371
+ assert.sameValue(arguments[0], 2);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+ assert.sameValue(a, 3);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js
new file mode 100644
index 0000000000..77cb38fe5b
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-configurable and
+ non-writable. Perform property attribute changes with two
+ [[DefineOwnProperty]] calls. Add intervening call to [[Set]].
+flags: [noStrict]
+---*/
+
+function argumentsNonConfigurableThenNonWritableWithInterveningSet(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+ arguments[0] = 2;
+ Object.defineProperty(arguments, "0", {writable: false});
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+ assert.sameValue(a, 3);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsNonConfigurableThenNonWritableWithInterveningSet(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js
new file mode 100644
index 0000000000..450c6bb79e
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-configurable and
+ non-writable. Perform property attribute changes with two
+ [[DefineOwnProperty]] calls. Add intervening call to
+ [[DefineOwnProperty]].
+flags: [noStrict]
+---*/
+
+function argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+ Object.defineProperty(arguments, "0", {value: 2});
+ Object.defineProperty(arguments, "0", {writable: false});
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+ assert.sameValue(a, 3);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js
new file mode 100644
index 0000000000..4255e6ae6a
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ was not deleted. [[Delete]] operations throws TypeError if called
+ from strict-mode code.
+flags: [noStrict]
+---*/
+
+function argumentsAndStrictDelete(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ var args = arguments;
+ assert.throws(TypeError, function() { "use strict"; delete args[0]; });
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+}
+argumentsAndStrictDelete(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js
new file mode 100644
index 0000000000..1786e32a2c
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ was not deleted. [[Delete]] operations throws TypeError if called
+ from strict-mode code. Variable is changed with SetMutableBinding.
+flags: [noStrict]
+---*/
+
+function argumentsAndStrictDeleteSetMutableBinding(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ // Precondition: Delete is unsuccessful and doesn't affect mapping.
+ var args = arguments;
+ assert.throws(TypeError, function() { "use strict"; delete args[0]; });
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ a = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndStrictDeleteSetMutableBinding(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js
new file mode 100644
index 0000000000..5f328c2ebd
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.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.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ was not deleted. [[Delete]] operations throws TypeError if called
+ from strict-mode code. Arguments property is changed with
+ [[DefineOwnProperty]].
+flags: [noStrict]
+---*/
+
+function argumentsAndStrictDeleteDefineOwnProperty(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ // Precondition: Delete is unsuccessful and doesn't affect mapping.
+ var args = arguments;
+ assert.throws(TypeError, function() { "use strict"; delete args[0]; });
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ Object.defineProperty(arguments, "0", {value: 2});
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndStrictDeleteDefineOwnProperty(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js
new file mode 100644
index 0000000000..bb2440ee8c
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapping works when property is non-configurable, arguments property
+ was not deleted. [[Delete]] operations throws TypeError if called
+ from strict-mode code. Arguments property is changed with [[Set]].
+flags: [noStrict]
+---*/
+
+function argumentsAndStrictDeleteSet(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ // Precondition: Delete is unsuccessful and doesn't affect mapping.
+ var args = arguments;
+ assert.throws(TypeError, function() { "use strict"; delete args[0]; });
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ arguments[0] = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsAndStrictDeleteSet(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js
new file mode 100644
index 0000000000..7b6f7df047
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-writable and
+ non-configurable. Perform property attribute changes with two
+ consecutive [[DefineOwnProperty]] calls. Mapped values are
+ unchanged, mapping itself is removed.
+flags: [noStrict]
+---*/
+
+function argumentsNonWritableThenNonConfigurable(a) {
+ Object.defineProperty(arguments, "0", {writable: false});
+ Object.defineProperty(arguments, "0", {configurable: false});
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 2;
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 1);
+}
+argumentsNonWritableThenNonConfigurable(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js
new file mode 100644
index 0000000000..86fc445420
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-writable and
+ non-configurable. Perform property attribute changes with two
+ [[DefineOwnProperty]] calls. Add intervening call to
+ SetMutableBinding.
+flags: [noStrict]
+---*/
+
+function argumentsNonWritableThenNonConfigurableWithInterveningSetMutableBinding(a) {
+ Object.defineProperty(arguments, "0", {writable: false});
+ a = 2;
+ Object.defineProperty(arguments, "0", {configurable: false});
+ assert.sameValue(a, 2);
+ assert.sameValue(arguments[0], 1);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+ assert.sameValue(a, 3);
+ assert.sameValue(arguments[0], 1);
+}
+argumentsNonWritableThenNonConfigurableWithInterveningSetMutableBinding(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js
new file mode 100644
index 0000000000..7ab519c589
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-writable and
+ non-configurable. Perform property attribute changes with two
+ [[DefineOwnProperty]] calls. Add intervening call to [[Set]].
+flags: [noStrict]
+---*/
+
+function argumentsNonWritableThenNonConfigurableWithInterveningSet(a) {
+ Object.defineProperty(arguments, "0", {writable: false});
+ arguments[0] = 2;
+ Object.defineProperty(arguments, "0", {configurable: false});
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 1);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+ assert.sameValue(a, 3);
+ assert.sameValue(arguments[0], 1);
+}
+argumentsNonWritableThenNonConfigurableWithInterveningSet(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js
new file mode 100644
index 0000000000..5c3033d9c7
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Mapped arguments object with non-configurable property
+description: >
+ Mapped arguments property is changed to non-writable and
+ non-configurable. Perform property attribute changes with two
+ [[DefineOwnProperty]] calls. Add intervening call to
+ [[DefineOwnProperty]].
+flags: [noStrict]
+---*/
+
+function argumentsNonWritableThenNonConfigurableWithInterveningDefineOwnProperty(a) {
+ Object.defineProperty(arguments, "0", {writable: false});
+ Object.defineProperty(arguments, "0", {value: 2});
+ Object.defineProperty(arguments, "0", {configurable: false});
+ assert.sameValue(a, 1);
+ assert.sameValue(arguments[0], 2);
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+ assert.sameValue(a, 3);
+ assert.sameValue(arguments[0], 2);
+}
+argumentsNonWritableThenNonConfigurableWithInterveningDefineOwnProperty(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js
new file mode 100644
index 0000000000..04ed41e285
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments object with non-configurable property property descriptor behavior
+info: |
+ Descriptor of a mapped value is updated when property is made non-configurable.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function argumentsNonConfigurable(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: true,
+ enumerable: true,
+ configurable: false,
+ });
+}
+argumentsNonConfigurable(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-define-failure.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-define-failure.js
new file mode 100644
index 0000000000..0552fa5d5b
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-define-failure.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+description: >
+ OrdinaryDefineOwnProperty returning `false` doesn't leave `arguments` in a
+ corrupted state, for both mapped and unmapped indices.
+info: |
+ [[DefineOwnProperty]] ( P, Desc )
+
+ [...]
+ 6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc).
+ 7. If allowed is false, return false.
+flags: [noStrict]
+---*/
+
+(function(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ assert.throws(TypeError, () => {
+ Object.defineProperty(arguments, "0", {configurable: true});
+ });
+
+ a = 2;
+ assert.sameValue(arguments[0], 2);
+
+
+ Object.defineProperty(arguments, "1", {
+ get: () => 3,
+ configurable: false,
+ });
+
+ assert.throws(TypeError, () => {
+ Object.defineProperty(arguments, "1", {value: "foo"});
+ });
+
+ assert.sameValue(arguments[1], 3);
+ assert.throws(TypeError, () => {
+ "use strict";
+ delete arguments[1];
+ });
+})(0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js
new file mode 100644
index 0000000000..35f2c7b4ae
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change with non-configurable property
+info: |
+ Mapping keep working when property is set to non-configurable and its
+ value is changed using arguments[i] where "i" is the argument index.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function argumentsAndSetByIndex(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ arguments[0] = 2;
+
+ assert.sameValue(a, 2);
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: true,
+ enumerable: true,
+ configurable: false,
+ });
+}
+argumentsAndSetByIndex(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js
new file mode 100644
index 0000000000..e6a846ecc7
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change with non-configurable property
+info: |
+ Mapping keep working when property is set to non-configurable and its
+ value is changed using [[DefineOwnProperty]].
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function setArgumentValueWithDefineOwnProperty(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ Object.defineProperty(arguments, "0", {value: 2});
+
+ assert.sameValue(a, 2);
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: true,
+ enumerable: true,
+ configurable: false,
+ });
+}
+setArgumentValueWithDefineOwnProperty(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js
new file mode 100644
index 0000000000..bd74d1a9fd
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Property descriptor of mapped arguments object with non-configurable property
+info: |
+ Mapping keep working when property is set to non-configurable, and its
+ descriptor needs to change properly.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function argumentsAndSetMutableBinding(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ a = 2;
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: true,
+ enumerable: true,
+ configurable: false,
+ });
+}
+argumentsAndSetMutableBinding(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js
new file mode 100644
index 0000000000..e05d630b5a
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change with non-configurable, non-enumerable and non-writable property
+info: |
+ Mapping stop working when property is set to non-writable. The
+ descriptor's enumerable property is the one set before the mapping removal.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {configurable: false, enumerable: false, writable: false});
+
+ // Postcondition: Arguments mapping is removed.
+ a = 2;
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js
new file mode 100644
index 0000000000..ad5f0fdee6
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-configurable, non-enumerable and non-writable
+info: |
+ Change the descriptor using [[DefineOwnProperty]] to {configurable: false, enumerable: false},
+ set arguments[0] = 2 and then change property descriptor to {writable: false}.
+ The descriptor's enumerable property is the one set before the mapping removal.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {configurable: false, enumerable: false});
+ arguments[0] = 2;
+ Object.defineProperty(arguments, "0", {writable: false});
+
+ assert.sameValue(a, 2);
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js
new file mode 100644
index 0000000000..358a00aa29
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-configurable, non-enumerable and non-writable
+info: |
+ Change the descriptor using [[DefineOwnProperty]] to
+ {configurable: false, enumerable: false}, set a = 2 and then
+ change property descriptor to {writable: false}. The descriptor's enumerable
+ property need to be the one set before the mapping removal.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {configurable: false, enumerable: false});
+ a = 2;
+ Object.defineProperty(arguments, "0", {writable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js
new file mode 100644
index 0000000000..0f8c003a77
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change with non-configurable and non-writable property
+info: |
+ Mapping stop working when property is set to non-writable. The
+ descriptor's value need to be the one set before the property be configured as
+ writable: false.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {configurable: false, writable: false});
+
+ // Postcondition: Arguments mapping is removed.
+ a = 2;
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js
new file mode 100644
index 0000000000..15fa2262bd
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change with non-configurable and non-writable property
+info: |
+ Mapping stop working when property is set to non-writable. Change the
+ descriptor with two [[DefineOwnProperty]] calls. The descriptor's value need to be
+ the one set before the property be configured as writable: false.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+ Object.defineProperty(arguments, "0", {writable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 2;
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js
new file mode 100644
index 0000000000..cb9bbc5ef0
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-configurable and non-writable
+info: |
+ Mapping just stop working when property is set to non-writable. Change the
+ descriptor using [[DefineOwnProperty]] to {configurable: false}, set arguments[0] = 2
+ and then change property descriptor to {writable: false}.
+ The descriptor's value need to be the one set before the property be
+ configured as {writable: false}.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+ arguments[0] = 2;
+ Object.defineProperty(arguments, "0", {writable: false});
+
+ assert.sameValue(a, 2)
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js
new file mode 100644
index 0000000000..ba9c4e855b
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-configurable and non-writable
+info: |
+ Mapping just stop working when property is set to non-writable. Change the
+ descriptor using [[DefineOwnProperty]] to {configurable: false}, set a = 2 and then
+ change property descriptor to {writable: false}. The descriptor's value is
+ the one set before the property be configured as {writable: false}.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {configurable: false});
+ a = 2;
+ Object.defineProperty(arguments, "0", {writable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js
new file mode 100644
index 0000000000..fc049f9d55
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-writable and non-configurable
+info: |
+ Mapping stop working when property is set to non-writable. Here we change the
+ descriptor using [[DefineOwnProperty]] to {writable: false} and then
+ change property descriptor to {configurable: false} in sequence.
+ The property descriptor need to be the one set before the property be
+ configured as {writable: false}.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {writable: false});
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed. Descriptors need to be the same
+ // as above.
+ a = 2;
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js
new file mode 100644
index 0000000000..dd617821ff
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-writable and non-configurable
+info: |
+ Mapping stop working when property is set to non-writable. Change the
+ descriptor using [[DefineOwnProperty]] to {writable: false}, set argument[0] = 2 and then
+ change property descriptor to {configurable: false}.
+ The descriptor's value is the one set before the property be
+ configured as {writable: false} because mapping was removed.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {writable: false});
+ arguments[0] = 2;
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ assert.sameValue(a, 1);
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js
new file mode 100644
index 0000000000..5f676d3ea7
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-writable and non-configurable
+info: |
+ Mapping just stop working when property is set to non-writable. Change the
+ descriptor using [[DefineOwnProperty]] to {writable: false}, set a = 2 and then
+ change property descriptor to {configurable: false}.
+ The descriptor's value is the one set before the property be
+ configured as {writable: false} because mapping was removed.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {writable: false});
+ a = 2;
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: true,
+ configurable: false,
+ });
+}
+fn(1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js
new file mode 100644
index 0000000000..984f40c567
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-writable and non-configurable
+info: |
+ Change the descriptor using [[DefineOwnProperty]] to
+ {writable: false, enumerable: false} and then
+ change property descriptor to {configurable: false}.
+ The descriptor's enumerable property continue with its configured value
+ even if mapping stops.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 2;
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+}
+fn(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js
new file mode 100644
index 0000000000..ac1ba8fd3d
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable
+info: |
+ Change the descriptor using [[DefineOwnProperty]] to {writable: false, enumerable: false},
+ set argument[0] = 2 and then change property descriptor to {configurable: false}.
+ The descriptor's enumerable property continues with its configured value.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
+ arguments[0] = 2;
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+}
+fn(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js
new file mode 100644
index 0000000000..c1c3d798ea
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable
+info: |
+ Change the descriptor using [[DefineOwnProperty]] to
+ {writable: false, enumerable: false}, change argument[0]
+ value to 2 using [[DefineOwnProperty]] and then
+ change property descriptor to {configurable: false}.
+ The descriptor's enumerable property continues with its configured value.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {writable: false, enumerable: false, value: 2, configurable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 2,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+}
+fn(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js
new file mode 100644
index 0000000000..263f43f60c
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2017 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable
+info: |
+ Change the descriptor using [[DefineOwnProperty]] to
+ {writable: false, enumerable: false}, set a = 2 and then
+ change property descriptor to {configurable: false}.
+ The descriptor's enumerable property continue with its configured value.
+flags: [noStrict]
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+includes: [propertyHelper.js]
+---*/
+
+function fn(a) {
+ Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
+ a = 2;
+ Object.defineProperty(arguments, "0", {configurable: false});
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+
+ // Postcondition: Arguments mapping is removed.
+ a = 3;
+
+ verifyProperty(arguments, "0", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: false,
+ });
+}
+fn(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/arguments-object/mapped/shell.js b/js/src/tests/test262/language/arguments-object/mapped/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/shell.js
diff --git a/js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js b/js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js
new file mode 100644
index 0000000000..01e9f2fb2f
--- /dev/null
+++ b/js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arguments-exotic-objects-defineownproperty-p-desc
+description: >
+ Index stays mapped when redefined with complete descriptor, which differs only
+ by the [[Value]] field. Unmapped index is created.
+info: |
+ [[DefineOwnProperty]] ( P, Desc )
+
+ [...]
+ 6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc).
+ 7. If allowed is false, return false.
+ 8. If isMapped is true, then
+ [...]
+ b. Else,
+ i. If Desc.[[Value]] is present, then
+ 1. Let setStatus be Set(map, P, Desc.[[Value]], false).
+ 2. Assert: setStatus is true because formal parameters mapped by argument objects are always writable.
+ 9. Return true.
+flags: [noStrict]
+---*/
+
+(function(a) {
+ Object.defineProperty(arguments, "0", {
+ value: "foo",
+ writable: true,
+ enumerable: true,
+ configurable: true,
+ });
+
+ assert.sameValue(a, "foo");
+ assert.sameValue(arguments[0], "foo");
+
+
+ Object.defineProperty(arguments, "1", {
+ value: "bar",
+ writable: true,
+ enumerable: true,
+ configurable: true,
+ });
+
+ assert.sameValue(arguments[1], "bar");
+})(0);
+
+reportCompare(0, 0);