mirror of https://github.com/tc39/test262.git
Adding test cases to validate property descriptors on cases of mapped arguments (#815)
This commit is contained in:
parent
28fc809f3e
commit
c2eacd956e
|
@ -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);
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
Loading…
Reference in New Issue