Debian Codegraph @

js/src/tests/test262/built-ins/JSON/parse/text-object-abrupt.js

raw
1 // Copyright (C) 2019 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-json.parse
5 description: >
6 Abrupt completion from Get and Call in ToPrimitive.
7 info: |
8 JSON.parse ( text [ , reviver ] )
9
10 1. Let JText be ? ToString(text).
11 ---*/
12
13 assert.throws(Test262Error, function() {
14 JSON.parse({
15 toString: null,
16 get valueOf() {
17 throw new Test262Error();
18 },
19 });
20 });
21
22 assert.throws(Test262Error, function() {
23 JSON.parse({
24 toString: function() {
25 throw new Test262Error();
26 },
27 });
28 });
29
30 reportCompare(0, 0);