Debian Codegraph @

js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-arguments.js

raw
1 // Copyright (C) 2017 Claude Pache. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-invariants-of-the-essential-internal-methods
5 description: >
6 Value of non-writable, non-configurable data property must not change
7 ("arguments" property of a non-strict function)
8 info: |
9 [[GetOwnProperty]] (P)
10 [...]
11 - If a property P is described as a data property with Desc.[[Value]] equal
12 to v and Desc.[[Writable]] and Desc.[[Configurable]] are both false, then
13 the SameValue must be returned for the Desc.[[Value]] attribute of the
14 property on all future calls to [[GetOwnProperty]] ( P ).
15 [...]
16 (This invariant was violated for the specific property under test by a number
17 of implementations as of January 2017.)
18 ---*/
19
20 function f() {
21 return Reflect.getOwnPropertyDescriptor(f, 'arguments');
22 }
23
24 Reflect.defineProperty(f, 'arguments', {
25 writable: false,
26 configurable: false
27 });
28
29 var desc = Reflect.getOwnPropertyDescriptor(f, 'arguments');
30 if (desc && desc.configurable === false && desc.writable === false) {
31 var desc2 = f();
32 assert.sameValue(desc.value, desc2.value);
33 }
34
35 reportCompare(0, 0);