Debian Codegraph @

js/src/tests/test262/language/arguments-object/mapped/nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-arguments.js

raw
1 // Copyright (C) 2017 Caio Lima. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable
6 info: |
7 Change the descriptor using [[DefineOwnProperty]] to {writable: false, enumerable: false},
8 set argument[0] = 2 and then change property descriptor to {configurable: false}.
9 The descriptor's enumerable property continues with its configured value.
10 flags: [noStrict]
11 esid: sec-arguments-exotic-objects-defineownproperty-p-desc
12 includes: [propertyHelper.js]
13 ---*/
14
15 function fn(a) {
16 Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
17 arguments[0] = 2;
18 Object.defineProperty(arguments, "0", {configurable: false});
19
20 verifyProperty(arguments, "0", {
21 value: 1,
22 writable: false,
23 enumerable: false,
24 configurable: false,
25 });
26
27 // Postcondition: Arguments mapping is removed.
28 a = 3;
29
30 verifyProperty(arguments, "0", {
31 value: 1,
32 writable: false,
33 enumerable: false,
34 configurable: false,
35 });
36 }
37 fn(1);
38
39 reportCompare(0, 0);