Debian Codegraph @

js/src/tests/test262/built-ins/JSON/rawJSON/builtin.js

raw
1 // |reftest| shell-option(--enable-json-parse-with-source) skip-if(!JSON.hasOwnProperty('isRawJSON')||!xulRuntime.shell) -- json-parse-with-source is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 Igalia S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-json.rawjson
7 description: >
8 JSON.rawJSON meets the requirements for built-in objects
9 info: |
10 JSON.isRawJSON ( O )
11
12 18 ECMAScript Standard Built-in Objects
13 ...
14 Unless specified otherwise, a built-in object that is callable as a function
15 is a built-in function object with the characteristics described in 10.3.
16 Unless specified otherwise, the [[Extensible]] internal slot of a built-in
17 object initially has the value true. Every built-in function object has a
18 [[Realm]] internal slot whose value is the Realm Record of the realm for
19 which the object was initially created.
20 ...
21 Unless otherwise specified every built-in function and every built-in
22 constructor has the Function prototype object, which is the initial value of
23 the expression Function.prototype (20.2.3), as the value of its [[Prototype]]
24 internal slot.
25 ...
26 Built-in function objects that are not identified as constructors do not
27 implement the [[Construct]] internal method unless otherwise specified in the
28 description of a particular function.
29
30 features: [json-parse-with-source]
31 ---*/
32
33 assert(Object.isExtensible(JSON.rawJSON), "JSON.rawJSON is extensible");
34 assert.sameValue(
35 typeof JSON.rawJSON,
36 'function',
37 'The value of `typeof JSON.rawJSON` is "function"'
38 );
39
40 assert.sameValue(
41 Object.getPrototypeOf(JSON.rawJSON),
42 Function.prototype,
43 "Prototype of JSON.rawJSON is Function.prototype"
44 );
45
46 assert.sameValue(
47 Object.getOwnPropertyDescriptor(JSON.rawJSON, "prototype"),
48 undefined,
49 "JSON.rawJSON has no own prototype property"
50 );
51
52 reportCompare(0, 0);