Debian Codegraph @

js/src/tests/test262/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-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-configurable, non-enumerable and non-writable
6 info: |
7 Change the descriptor using [[DefineOwnProperty]] to {configurable: false, enumerable: false},
8 set arguments[0] = 2 and then change property descriptor to {writable: false}.
9 The descriptor's enumerable property is the one set before the mapping removal.
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", {configurable: false, enumerable: false});
17 arguments[0] = 2;
18 Object.defineProperty(arguments, "0", {writable: false});
19
20 assert.sameValue(a, 2);
21
22 verifyProperty(arguments, "0", {
23 value: 2,
24 writable: false,
25 enumerable: false,
26 configurable: false,
27 });
28
29 // Postcondition: Arguments mapping is removed.
30 a = 3;
31
32 verifyProperty(arguments, "0", {
33 value: 2,
34 writable: false,
35 enumerable: false,
36 configurable: false,
37 });
38 }
39 fn(1);
40
41
42 reportCompare(0, 0);