Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/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 es6id: 6.1.7.3
6 description: >
7 Value of non-writable, non-configurable data property must not change
8 ("arguments" property of a non-strict function)
9 info: |
10 [[GetOwnProperty]] (P)
11 [...]
12 - If a property P is described as a data property with Desc.[[Value]] equal
13 to v and Desc.[[Writable]] and Desc.[[Configurable]] are both false, then
14 the SameValue must be returned for the Desc.[[Value]] attribute of the
15 property on all future calls to [[GetOwnProperty]] ( P ).
16 [...]
17 (This invariant was violated for the specific property under test by a number
18 of implementations as of January 2017.)
19 ---*/
20
21 function f() {
22 return Reflect.getOwnPropertyDescriptor(f, 'arguments');
23 }
24
25 Reflect.defineProperty(f, 'arguments', {
26 writable: false,
27 configurable: false
28 });
29
30 var desc = Reflect.getOwnPropertyDescriptor(f, 'arguments');
31 if (desc && desc.configurable === false && desc.writable === false) {
32 var desc2 = f();
33 assert.sameValue(desc.value, desc2.value);
34 }