Debian Codegraph @

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