diff --git a/test/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js b/test/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js new file mode 100644 index 0000000000000000000000000000000000000000..e7e8891bb5df30e40df265446b785fc2d66a4db0 --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-descriptors-basic.js @@ -0,0 +1,22 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +argumentsNonConfigurable(1); diff --git a/test/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js b/test/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js new file mode 100644 index 0000000000000000000000000000000000000000..50ae4dd904381f244faf8ae5ffbb31472fe387f5 --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js @@ -0,0 +1,27 @@ +// 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; + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(a, 2); + verifyEnumerable(arguments, "0"); + verifyWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +argumentsAndSetByIndex(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js b/test/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js new file mode 100644 index 0000000000000000000000000000000000000000..181609f8038634216802d7cc327a69e53e89edad --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js @@ -0,0 +1,27 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(a, 2); + verifyEnumerable(arguments, "0"); + verifyWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +setArgumentValueWithDefineOwnProperty(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js b/test/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js new file mode 100644 index 0000000000000000000000000000000000000000..d4c163a458440336ca9204edea65165dcda44636 --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.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: 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; + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyEnumerable(arguments, "0"); + verifyWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +argumentsAndSetMutableBinding(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js b/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js new file mode 100644 index 0000000000000000000000000000000000000000..344e5b853b8c2aef8e0a9e58cd4927a70f0409b2 --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-basic.js @@ -0,0 +1,27 @@ +// 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; + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js b/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js new file mode 100644 index 0000000000000000000000000000000000000000..3d52700a163f3be964cdbc8ff02495612c283420 --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js @@ -0,0 +1,36 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(a, 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js b/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js new file mode 100644 index 0000000000000000000000000000000000000000..d66a94d35991397b127bc880eae2fdb54246bf38 --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js @@ -0,0 +1,36 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js b/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js new file mode 100644 index 0000000000000000000000000000000000000000..60c6960371af9b3504261bad3971355b688b168e --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-basic.js @@ -0,0 +1,28 @@ +// 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; + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js b/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js new file mode 100644 index 0000000000000000000000000000000000000000..03c9d07b98349fd0a2cde321c2f7b27ddbc5efe1 --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js @@ -0,0 +1,34 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 2; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js b/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js new file mode 100644 index 0000000000000000000000000000000000000000..fa4da2fcfe52dfa5ad88491acc567958fd9ceb50 --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js @@ -0,0 +1,37 @@ +// 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}); + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(a, 2) + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js b/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js new file mode 100644 index 0000000000000000000000000000000000000000..a3025f7e812f11376bfaea580bc992129fdb7a2f --- /dev/null +++ b/test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js @@ -0,0 +1,36 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js b/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js new file mode 100644 index 0000000000000000000000000000000000000000..dead55dc0a25c22f1d62b1fdad61118aaff31249 --- /dev/null +++ b/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-basic.js @@ -0,0 +1,36 @@ +// 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}); + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. Descriptors need to be the same + // as above. + a = 2; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js b/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js new file mode 100644 index 0000000000000000000000000000000000000000..2bd6995a12e6d881efce9509b48292af7e535d26 --- /dev/null +++ b/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-arguments.js @@ -0,0 +1,37 @@ +// 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}); + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + assert.sameValue(a, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js b/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js new file mode 100644 index 0000000000000000000000000000000000000000..b5a04c136eb61f4dda5cab23c04c2f777252b3de --- /dev/null +++ b/test/language/arguments-object/mapped/nonwritable-nonconfigurable-descriptors-set-by-param.js @@ -0,0 +1,28 @@ +// 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}); + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); + diff --git a/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js b/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js new file mode 100644 index 0000000000000000000000000000000000000000..273a0040ff63b26edb716afa53ffb44ff57dc636 --- /dev/null +++ b/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-basic.js @@ -0,0 +1,35 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 2; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); diff --git a/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js b/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js new file mode 100644 index 0000000000000000000000000000000000000000..e345eb2566011805f70e95363fb310e15179ea06 --- /dev/null +++ b/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js @@ -0,0 +1,34 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); diff --git a/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js b/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js new file mode 100644 index 0000000000000000000000000000000000000000..04d83c6a9e7c673cfe1207f7ef4a87b06653a8bb --- /dev/null +++ b/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-define-property.js @@ -0,0 +1,27 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 2); + assert.sameValue(arguments[0], 2); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1); diff --git a/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js b/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js new file mode 100644 index 0000000000000000000000000000000000000000..49b75ecfed1c97aa8ffd33d7ecf7650cb0e5744f --- /dev/null +++ b/test/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js @@ -0,0 +1,35 @@ +// 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}); + + let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); + + // Postcondition: Arguments mapping is removed. + a = 3; + propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); + assert.sameValue(propertyDescriptor.value, 1); + verifyNotEnumerable(arguments, "0"); + verifyNotWritable(arguments, "0"); + verifyNotConfigurable(arguments, "0"); +} +fn(1);