Debian Codegraph @

js/src/tests/test262/language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-5.js

raw
1 // Copyright (C) 2015 André Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: Mapped arguments object with non-configurable property
6 description: >
7 Mapped arguments property is changed to non-configurable and
8 non-writable. Perform property attribute changes with two
9 [[DefineOwnProperty]] calls. Add intervening call to
10 [[DefineOwnProperty]].
11 flags: [noStrict]
12 ---*/
13
14 function argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(a) {
15 Object.defineProperty(arguments, "0", {configurable: false});
16 Object.defineProperty(arguments, "0", {value: 2});
17 Object.defineProperty(arguments, "0", {writable: false});
18 assert.sameValue(a, 2);
19 assert.sameValue(arguments[0], 2);
20
21 // Postcondition: Arguments mapping is removed.
22 a = 3;
23 assert.sameValue(a, 3);
24 assert.sameValue(arguments[0], 2);
25 }
26 argumentsNonConfigurableThenNonWritableWithDefineOwnProperty(1);
27
28 reportCompare(0, 0);