Debian Codegraph @

js/src/tests/test262/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.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 ("$1" property of the RegExp built-in)
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 at least
17 one implementation as of January 2017.)
18 ---*/
19
20 Reflect.defineProperty(RegExp, '$1', {
21 writable: false,
22 configurable: false
23 });
24
25 var desc = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
26 if (desc && desc.configurable === false && desc.writable === false) {
27 /(x)/.exec('x');
28 var desc2 = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
29 assert.sameValue(desc.value, desc2.value);
30 }
31
32 reportCompare(0, 0);