From cd3829627d20f1e009dbbe2fe9dfefc839a4ac81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 18 May 2015 18:30:36 +0200 Subject: [PATCH 1/4] MOP operations on non-configurable arguments-object property Mapped arguments property is changed to non-configurable. Check arguments mapping works correctly when applying various MOP methods. --- .../mapped-arguments-nonconfigurable.js | 322 ++++++++++++++++++ 1 file changed, 322 insertions(+) create mode 100755 test/language/arguments-object/mapped-arguments-nonconfigurable.js diff --git a/test/language/arguments-object/mapped-arguments-nonconfigurable.js b/test/language/arguments-object/mapped-arguments-nonconfigurable.js new file mode 100755 index 0000000000..cf797a15a5 --- /dev/null +++ b/test/language/arguments-object/mapped-arguments-nonconfigurable.js @@ -0,0 +1,322 @@ +// 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. Check + arguments mapping works correctly when applying various MOP + methods. +includes: [assert.js] +flags: [noStrict] +---*/ + + +function argumentsNonConfigurable(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Mapping values are not changed when property was made non-configurable. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); +} +argumentsNonConfigurable(1); + +function argumentsAndSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Mapping works when property is non-configurable, variable is changed with SetMutableBinding. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndSetMutableBinding(1); + +function argumentsAndDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. + Object.defineProperty(arguments, "0", {value: 2}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndDefineOwnProperty(1); + +function argumentsAndSet(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Mapping works when property is non-configurable, arguments property is changed with [[Set]]. + arguments[0] = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndSet(1); + +function argumentsAndDelete(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Property is non-configurable, [[Delete]] returns false. + assert.sameValue(delete arguments[0], false); + + // Mapping works when property is non-configurable, arguments property was not deleted. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); +} +argumentsAndDelete(1); + +function argumentsAndDeleteSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Property is non-configurable, [[Delete]] returns false. + assert.sameValue(delete arguments[0], false); + + // Mapping works when property is non-configurable, arguments property was not deleted. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Mapping works when property is non-configurable, variable is changed with SetMutableBinding. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndDeleteSetMutableBinding(1); + +function argumentsAndDeleteDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Property is non-configurable, [[Delete]] returns false. + assert.sameValue(delete arguments[0], false); + + // Mapping works when property is non-configurable, arguments property was not deleted. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. + Object.defineProperty(arguments, "0", {value: 2}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndDeleteDefineOwnProperty(1); + +function argumentsAndDeleteSet(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Property is non-configurable, [[Delete]] returns false. + assert.sameValue(delete arguments[0], false); + + // Mapping works when property is non-configurable, arguments property was not deleted. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. + arguments[0] = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndDeleteSet(1); + +function argumentsAndStrictDelete(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Property is non-configurable, [[Delete]] throws TypeError in strict mode. + var args = arguments; + assert.throws(TypeError, function() { "use strict"; delete args[0]; }); + + // Mapping works when property is non-configurable, arguments property was not deleted. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); +} +argumentsAndStrictDelete(1); + +function argumentsAndStrictDeleteSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Property is non-configurable, [[Delete]] throws TypeError in strict mode. + var args = arguments; + assert.throws(TypeError, function() { "use strict"; delete args[0]; }); + + // Mapping works when property is non-configurable, arguments property was not deleted. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Mapping works when property is non-configurable, variable is changed with SetMutableBinding. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndStrictDeleteSetMutableBinding(1); + +function argumentsAndStrictDeleteDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Property is non-configurable, [[Delete]] throws TypeError in strict mode. + var args = arguments; + assert.throws(TypeError, function() { "use strict"; delete args[0]; }); + + // Mapping works when property is non-configurable, arguments property was not deleted. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. + Object.defineProperty(arguments, "0", {value: 2}); + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndStrictDeleteDefineOwnProperty(1); + +function argumentsAndStrictDeleteSet(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + // Property is non-configurable, [[Delete]] throws TypeError in strict mode. + var args = arguments; + assert.throws(TypeError, function() { "use strict"; delete args[0]; }); + + // Mapping works when property is non-configurable, arguments property was not deleted. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. + arguments[0] = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndStrictDeleteSet(1); + +function argumentsNonConfigurableAndNonWritable(a) { + Object.defineProperty(arguments, "0", {configurable: false, writable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Arguments property is no longer mapped. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); +} +argumentsNonConfigurableAndNonWritable(1); + +function argumentsNonConfigurableThenNonWritable(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + Object.defineProperty(arguments, "0", {writable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Arguments property is no longer mapped. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); +} +argumentsNonConfigurableThenNonWritable(1); + +function argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + a = 2; + Object.defineProperty(arguments, "0", {writable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); + + // Arguments property is no longer mapped. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 1); +} +argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(1); + +function argumentsNonConfigurableThenNonWritableWithInterveningSet(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + arguments[0] = 2; + Object.defineProperty(arguments, "0", {writable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); + + // Arguments property is no longer mapped. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 2); +} +argumentsNonConfigurableThenNonWritableWithInterveningSet(1); + +function argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + Object.defineProperty(arguments, "0", {value: 2}); + Object.defineProperty(arguments, "0", {writable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); + + // Arguments property is no longer mapped. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 2); +} +argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(1); + +function argumentsNonWritableThenNonConfigurable(a) { + Object.defineProperty(arguments, "0", {writable: false}); + Object.defineProperty(arguments, "0", {configurable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Arguments property is no longer mapped. + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); +} +argumentsNonWritableThenNonConfigurable(1); + +function argumentsNonWritableThenNonConfigurableWithInterveningSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {writable: false}); + a = 2; + Object.defineProperty(arguments, "0", {configurable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 1); + + // Arguments property is no longer mapped. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 1); +} +argumentsNonWritableThenNonConfigurableWithInterveningSetMutableBinding(1); + +function argumentsNonWritableThenNonConfigurableWithInterveningSet(a) { + Object.defineProperty(arguments, "0", {writable: false}); + arguments[0] = 2; + Object.defineProperty(arguments, "0", {configurable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); + + // Arguments property is no longer mapped. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 1); +} +argumentsNonWritableThenNonConfigurableWithInterveningSet(1); + +function argumentsNonWritableThenNonConfigurableWithInterveningDefineOwnProperty(a) { + Object.defineProperty(arguments, "0", {writable: false}); + Object.defineProperty(arguments, "0", {value: 2}); + Object.defineProperty(arguments, "0", {configurable: false}); + + // Mapping is removed when property was made non-writable, values are not changed. + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 2); + + // Arguments property is no longer mapped. + a = 3; + assert.sameValue(a, 3); + assert.sameValue(arguments[0], 2); +} +argumentsNonWritableThenNonConfigurableWithInterveningDefineOwnProperty(1); From af1ef75ffc7b7c9fee4e07fce28692b5cd6d9495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Tue, 19 May 2015 17:50:41 +0200 Subject: [PATCH 2/4] Split in multiple files --- .../mapped-arguments-nonconfigurable.js | 322 ------------------ .../mapped-arguments-nonconfigurable-1.js | 18 + .../mapped-arguments-nonconfigurable-2.js | 20 ++ .../mapped-arguments-nonconfigurable-3.js | 20 ++ .../mapped-arguments-nonconfigurable-4.js | 20 ++ ...pped-arguments-nonconfigurable-delete-1.js | 20 ++ ...pped-arguments-nonconfigurable-delete-2.js | 25 ++ ...pped-arguments-nonconfigurable-delete-3.js | 26 ++ ...pped-arguments-nonconfigurable-delete-4.js | 26 ++ ...arguments-nonconfigurable-nonwritable-1.js | 25 ++ ...arguments-nonconfigurable-nonwritable-2.js | 26 ++ ...arguments-nonconfigurable-nonwritable-3.js | 27 ++ ...arguments-nonconfigurable-nonwritable-4.js | 26 ++ ...arguments-nonconfigurable-nonwritable-5.js | 27 ++ ...guments-nonconfigurable-strict-delete-1.js | 22 ++ ...guments-nonconfigurable-strict-delete-2.js | 27 ++ ...guments-nonconfigurable-strict-delete-3.js | 28 ++ ...guments-nonconfigurable-strict-delete-4.js | 27 ++ ...arguments-nonwritable-nonconfigurable-1.js | 26 ++ ...arguments-nonwritable-nonconfigurable-2.js | 27 ++ ...arguments-nonwritable-nonconfigurable-3.js | 26 ++ ...arguments-nonwritable-nonconfigurable-4.js | 27 ++ 22 files changed, 516 insertions(+), 322 deletions(-) delete mode 100755 test/language/arguments-object/mapped-arguments-nonconfigurable.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js create mode 100755 test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js diff --git a/test/language/arguments-object/mapped-arguments-nonconfigurable.js b/test/language/arguments-object/mapped-arguments-nonconfigurable.js deleted file mode 100755 index cf797a15a5..0000000000 --- a/test/language/arguments-object/mapped-arguments-nonconfigurable.js +++ /dev/null @@ -1,322 +0,0 @@ -// 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. Check - arguments mapping works correctly when applying various MOP - methods. -includes: [assert.js] -flags: [noStrict] ----*/ - - -function argumentsNonConfigurable(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Mapping values are not changed when property was made non-configurable. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); -} -argumentsNonConfigurable(1); - -function argumentsAndSetMutableBinding(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Mapping works when property is non-configurable, variable is changed with SetMutableBinding. - a = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndSetMutableBinding(1); - -function argumentsAndDefineOwnProperty(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. - Object.defineProperty(arguments, "0", {value: 2}); - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndDefineOwnProperty(1); - -function argumentsAndSet(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Mapping works when property is non-configurable, arguments property is changed with [[Set]]. - arguments[0] = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndSet(1); - -function argumentsAndDelete(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Property is non-configurable, [[Delete]] returns false. - assert.sameValue(delete arguments[0], false); - - // Mapping works when property is non-configurable, arguments property was not deleted. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); -} -argumentsAndDelete(1); - -function argumentsAndDeleteSetMutableBinding(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Property is non-configurable, [[Delete]] returns false. - assert.sameValue(delete arguments[0], false); - - // Mapping works when property is non-configurable, arguments property was not deleted. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Mapping works when property is non-configurable, variable is changed with SetMutableBinding. - a = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndDeleteSetMutableBinding(1); - -function argumentsAndDeleteDefineOwnProperty(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Property is non-configurable, [[Delete]] returns false. - assert.sameValue(delete arguments[0], false); - - // Mapping works when property is non-configurable, arguments property was not deleted. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. - Object.defineProperty(arguments, "0", {value: 2}); - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndDeleteDefineOwnProperty(1); - -function argumentsAndDeleteSet(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Property is non-configurable, [[Delete]] returns false. - assert.sameValue(delete arguments[0], false); - - // Mapping works when property is non-configurable, arguments property was not deleted. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. - arguments[0] = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndDeleteSet(1); - -function argumentsAndStrictDelete(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Property is non-configurable, [[Delete]] throws TypeError in strict mode. - var args = arguments; - assert.throws(TypeError, function() { "use strict"; delete args[0]; }); - - // Mapping works when property is non-configurable, arguments property was not deleted. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); -} -argumentsAndStrictDelete(1); - -function argumentsAndStrictDeleteSetMutableBinding(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Property is non-configurable, [[Delete]] throws TypeError in strict mode. - var args = arguments; - assert.throws(TypeError, function() { "use strict"; delete args[0]; }); - - // Mapping works when property is non-configurable, arguments property was not deleted. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Mapping works when property is non-configurable, variable is changed with SetMutableBinding. - a = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndStrictDeleteSetMutableBinding(1); - -function argumentsAndStrictDeleteDefineOwnProperty(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Property is non-configurable, [[Delete]] throws TypeError in strict mode. - var args = arguments; - assert.throws(TypeError, function() { "use strict"; delete args[0]; }); - - // Mapping works when property is non-configurable, arguments property was not deleted. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. - Object.defineProperty(arguments, "0", {value: 2}); - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndStrictDeleteDefineOwnProperty(1); - -function argumentsAndStrictDeleteSet(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - - // Property is non-configurable, [[Delete]] throws TypeError in strict mode. - var args = arguments; - assert.throws(TypeError, function() { "use strict"; delete args[0]; }); - - // Mapping works when property is non-configurable, arguments property was not deleted. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. - arguments[0] = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); -} -argumentsAndStrictDeleteSet(1); - -function argumentsNonConfigurableAndNonWritable(a) { - Object.defineProperty(arguments, "0", {configurable: false, writable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Arguments property is no longer mapped. - a = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 1); -} -argumentsNonConfigurableAndNonWritable(1); - -function argumentsNonConfigurableThenNonWritable(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - Object.defineProperty(arguments, "0", {writable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Arguments property is no longer mapped. - a = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 1); -} -argumentsNonConfigurableThenNonWritable(1); - -function argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - a = 2; - Object.defineProperty(arguments, "0", {writable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 1); - - // Arguments property is no longer mapped. - a = 3; - assert.sameValue(a, 3); - assert.sameValue(arguments[0], 1); -} -argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(1); - -function argumentsNonConfigurableThenNonWritableWithInterveningSet(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - arguments[0] = 2; - Object.defineProperty(arguments, "0", {writable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); - - // Arguments property is no longer mapped. - a = 3; - assert.sameValue(a, 3); - assert.sameValue(arguments[0], 2); -} -argumentsNonConfigurableThenNonWritableWithInterveningSet(1); - -function argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(a) { - Object.defineProperty(arguments, "0", {configurable: false}); - Object.defineProperty(arguments, "0", {value: 2}); - Object.defineProperty(arguments, "0", {writable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 2); - - // Arguments property is no longer mapped. - a = 3; - assert.sameValue(a, 3); - assert.sameValue(arguments[0], 2); -} -argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(1); - -function argumentsNonWritableThenNonConfigurable(a) { - Object.defineProperty(arguments, "0", {writable: false}); - Object.defineProperty(arguments, "0", {configurable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Arguments property is no longer mapped. - a = 2; - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 1); -} -argumentsNonWritableThenNonConfigurable(1); - -function argumentsNonWritableThenNonConfigurableWithInterveningSetMutableBinding(a) { - Object.defineProperty(arguments, "0", {writable: false}); - a = 2; - Object.defineProperty(arguments, "0", {configurable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 2); - assert.sameValue(arguments[0], 1); - - // Arguments property is no longer mapped. - a = 3; - assert.sameValue(a, 3); - assert.sameValue(arguments[0], 1); -} -argumentsNonWritableThenNonConfigurableWithInterveningSetMutableBinding(1); - -function argumentsNonWritableThenNonConfigurableWithInterveningSet(a) { - Object.defineProperty(arguments, "0", {writable: false}); - arguments[0] = 2; - Object.defineProperty(arguments, "0", {configurable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 1); - - // Arguments property is no longer mapped. - a = 3; - assert.sameValue(a, 3); - assert.sameValue(arguments[0], 1); -} -argumentsNonWritableThenNonConfigurableWithInterveningSet(1); - -function argumentsNonWritableThenNonConfigurableWithInterveningDefineOwnProperty(a) { - Object.defineProperty(arguments, "0", {writable: false}); - Object.defineProperty(arguments, "0", {value: 2}); - Object.defineProperty(arguments, "0", {configurable: false}); - - // Mapping is removed when property was made non-writable, values are not changed. - assert.sameValue(a, 1); - assert.sameValue(arguments[0], 2); - - // Arguments property is no longer mapped. - a = 3; - assert.sameValue(a, 3); - assert.sameValue(arguments[0], 2); -} -argumentsNonWritableThenNonConfigurableWithInterveningDefineOwnProperty(1); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js new file mode 100755 index 0000000000..d0445fd3ab --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js @@ -0,0 +1,18 @@ +// 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. +includes: [assert.js] +flags: [noStrict] +---*/ + +function argumentsNonConfigurable(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + assert.sameValue(a, 1); + assert.sameValue(arguments[0], 1); +} +argumentsNonConfigurable(1); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js new file mode 100755 index 0000000000..9bd0acd884 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js @@ -0,0 +1,20 @@ +// 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. +includes: [assert.js] +flags: [noStrict] +---*/ + +function argumentsAndSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + + a = 2; + assert.sameValue(a, 2); + assert.sameValue(arguments[0], 2); +} +argumentsAndSetMutableBinding(1); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js new file mode 100755 index 0000000000..7db25bffa7 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js @@ -0,0 +1,20 @@ +// 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]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js new file mode 100755 index 0000000000..4aebeced23 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js @@ -0,0 +1,20 @@ +// 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]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js new file mode 100755 index 0000000000..b30b22a020 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js @@ -0,0 +1,20 @@ +// 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. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js new file mode 100755 index 0000000000..bb4bde6136 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js @@ -0,0 +1,25 @@ +// 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. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js new file mode 100755 index 0000000000..40bc07c71f --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.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. Arguments property is changed with + [[DefineOwnProperty]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js new file mode 100755 index 0000000000..2cd5a04d45 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.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. Arguments property is changed with + [[Set]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js new file mode 100755 index 0000000000..8f6b0b3454 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js @@ -0,0 +1,25 @@ +// 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. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js new file mode 100755 index 0000000000..62d1016f28 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-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: > + 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. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js new file mode 100755 index 0000000000..e0588955c8 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-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-configurable and + non-writable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to + SetMutableBinding. +includes: [assert.js] +flags: [noStrict] +---*/ + +function argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(a) { + Object.defineProperty(arguments, "0", {configurable: false}); + a = 2; + Object.defineProperty(arguments, "0", {writable: 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); +} +argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(1); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js new file mode 100755 index 0000000000..ced92a2608 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.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 two + [[DefineOwnProperty]] calls. Add intervening call to [[Set]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js new file mode 100755 index 0000000000..35f4410aa5 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.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 + [[DefineOwnProperty]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js new file mode 100755 index 0000000000..2986447e85 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js @@ -0,0 +1,22 @@ +// 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. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js new file mode 100755 index 0000000000..817fd2b3e3 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-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: > + 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. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js new file mode 100755 index 0000000000..ff43bd6f47 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.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 + [[DefineOwnProperty]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js new file mode 100755 index 0000000000..c84cf778f5 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-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. [[Delete]] operations throws TypeError if called + from strict-mode code. Arguments property is changed with [[Set]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js new file mode 100755 index 0000000000..d70d70a399 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-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-writable and + non-configurable. Perform property attribute changes with two + consecutive [[DefineOwnProperty]] calls. Mapped values are + unchanged, mapping itself is removed. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js new file mode 100755 index 0000000000..b41384d05c --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-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-writable and + non-configurable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to + SetMutableBinding. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js new file mode 100755 index 0000000000..bf601d404e --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.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-writable and + non-configurable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to [[Set]]. +includes: [assert.js] +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); diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js new file mode 100755 index 0000000000..62f11cb2d6 --- /dev/null +++ b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-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-writable and + non-configurable. Perform property attribute changes with two + [[DefineOwnProperty]] calls. Add intervening call to + [[DefineOwnProperty]]. +includes: [assert.js] +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); From ab6809cf472ea109b332b8b7696eb7cf0b6847fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 20 May 2015 22:12:31 +0200 Subject: [PATCH 3/4] Remove assert.js includes. --- .../mapped/mapped-arguments-nonconfigurable-1.js | 1 - .../mapped/mapped-arguments-nonconfigurable-2.js | 1 - .../mapped/mapped-arguments-nonconfigurable-3.js | 1 - .../mapped/mapped-arguments-nonconfigurable-4.js | 1 - .../mapped/mapped-arguments-nonconfigurable-delete-1.js | 1 - .../mapped/mapped-arguments-nonconfigurable-delete-2.js | 1 - .../mapped/mapped-arguments-nonconfigurable-delete-3.js | 1 - .../mapped/mapped-arguments-nonconfigurable-delete-4.js | 1 - .../mapped/mapped-arguments-nonconfigurable-nonwritable-1.js | 1 - .../mapped/mapped-arguments-nonconfigurable-nonwritable-2.js | 1 - .../mapped/mapped-arguments-nonconfigurable-nonwritable-3.js | 2 +- .../mapped/mapped-arguments-nonconfigurable-nonwritable-4.js | 1 - .../mapped/mapped-arguments-nonconfigurable-nonwritable-5.js | 1 - .../mapped/mapped-arguments-nonconfigurable-strict-delete-1.js | 1 - .../mapped/mapped-arguments-nonconfigurable-strict-delete-2.js | 1 - .../mapped/mapped-arguments-nonconfigurable-strict-delete-3.js | 1 - .../mapped/mapped-arguments-nonconfigurable-strict-delete-4.js | 1 - .../mapped/mapped-arguments-nonwritable-nonconfigurable-1.js | 1 - .../mapped/mapped-arguments-nonwritable-nonconfigurable-2.js | 1 - .../mapped/mapped-arguments-nonwritable-nonconfigurable-3.js | 1 - .../mapped/mapped-arguments-nonwritable-nonconfigurable-4.js | 1 - 21 files changed, 1 insertion(+), 21 deletions(-) diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js index d0445fd3ab..08925e079b 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-1.js @@ -5,7 +5,6 @@ info: Mapped arguments object with non-configurable property description: > Mapped value is not changed when property was made non-configurable. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js index 9bd0acd884..265481e015 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js @@ -6,7 +6,6 @@ info: Mapped arguments object with non-configurable property description: > Mapping works when property is non-configurable, variable is changed with SetMutableBinding. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js index 7db25bffa7..6877a0c9d9 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-3.js @@ -6,7 +6,6 @@ info: Mapped arguments object with non-configurable property description: > Mapping works when property is non-configurable, arguments property is changed with [[DefineOwnProperty]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js index 4aebeced23..d2ac4d376c 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js @@ -6,7 +6,6 @@ info: Mapped arguments object with non-configurable property description: > Mapping works when property is non-configurable, arguments property is changed with [[Set]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js index b30b22a020..67f9713691 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-1.js @@ -6,7 +6,6 @@ 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. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js index bb4bde6136..9a089eaacc 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js @@ -6,7 +6,6 @@ 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. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js index 40bc07c71f..26676a4eee 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-3.js @@ -7,7 +7,6 @@ description: > Mapping works when property is non-configurable, arguments property was not deleted. Arguments property is changed with [[DefineOwnProperty]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js index 2cd5a04d45..ed96a0e67a 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js @@ -7,7 +7,6 @@ description: > Mapping works when property is non-configurable, arguments property was not deleted. Arguments property is changed with [[Set]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js index 8f6b0b3454..cfeba05c48 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-1.js @@ -8,7 +8,6 @@ description: > non-writable. Perform property attribute changes with a single [[DefineOwnProperty]] call. Mapped values are unchanged, mapping itself is removed. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js index 62d1016f28..69c0e125ba 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-2.js @@ -8,7 +8,6 @@ description: > non-writable. Perform property attribute changes with two consecutive [[DefineOwnProperty]] calls. Mapped values are unchanged, mapping itself is removed. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js index e0588955c8..aac554c2f3 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js @@ -8,7 +8,7 @@ description: > non-writable. Perform property attribute changes with two [[DefineOwnProperty]] calls. Add intervening call to SetMutableBinding. -includes: [assert.js] + Specification bug: https://bugs.ecmascript.org/show_bug.cgi?id=4371 flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js index ced92a2608..80d56fe1c5 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js @@ -7,7 +7,6 @@ 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]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js index 35f4410aa5..bbb951502d 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js @@ -8,7 +8,6 @@ description: > non-writable. Perform property attribute changes with two [[DefineOwnProperty]] calls. Add intervening call to [[DefineOwnProperty]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js index 2986447e85..b918f75a10 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-1.js @@ -7,7 +7,6 @@ description: > Mapping works when property is non-configurable, arguments property was not deleted. [[Delete]] operations throws TypeError if called from strict-mode code. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js index 817fd2b3e3..01afbe4de3 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js @@ -7,7 +7,6 @@ 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. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js index ff43bd6f47..9aa2a2ed23 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-3.js @@ -8,7 +8,6 @@ description: > was not deleted. [[Delete]] operations throws TypeError if called from strict-mode code. Arguments property is changed with [[DefineOwnProperty]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js index c84cf778f5..b480188436 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js @@ -7,7 +7,6 @@ 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]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js index d70d70a399..2dae076788 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-1.js @@ -8,7 +8,6 @@ description: > non-configurable. Perform property attribute changes with two consecutive [[DefineOwnProperty]] calls. Mapped values are unchanged, mapping itself is removed. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js index b41384d05c..63585b437e 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-2.js @@ -8,7 +8,6 @@ description: > non-configurable. Perform property attribute changes with two [[DefineOwnProperty]] calls. Add intervening call to SetMutableBinding. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js index bf601d404e..2bd1bc9c12 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-3.js @@ -7,7 +7,6 @@ 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]]. -includes: [assert.js] flags: [noStrict] ---*/ diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js index 62f11cb2d6..ea40a49a82 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonwritable-nonconfigurable-4.js @@ -8,7 +8,6 @@ description: > non-configurable. Perform property attribute changes with two [[DefineOwnProperty]] calls. Add intervening call to [[DefineOwnProperty]]. -includes: [assert.js] flags: [noStrict] ---*/ From eace19ef91ca13d38b47f3e999d0e7fc068801ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 20 May 2015 22:13:17 +0200 Subject: [PATCH 4/4] Check for intended semantics --- .../mapped-arguments-nonconfigurable-nonwritable-3.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js index aac554c2f3..dca0adcd23 100755 --- a/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js +++ b/test/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js @@ -8,7 +8,6 @@ description: > non-writable. Perform property attribute changes with two [[DefineOwnProperty]] calls. Add intervening call to SetMutableBinding. - Specification bug: https://bugs.ecmascript.org/show_bug.cgi?id=4371 flags: [noStrict] ---*/ @@ -17,11 +16,13 @@ function argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding a = 2; Object.defineProperty(arguments, "0", {writable: false}); assert.sameValue(a, 2); - assert.sameValue(arguments[0], 1); + // `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], 1); + assert.sameValue(arguments[0], 2); } argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(1);