Debian Codegraph @

js/src/tests/test262/built-ins/JSON/parse/reviver-get-name-err.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-internalizejsonproperty
5 description: Abrupt completion from "holder" property access while reviving
6 info: |
7 JSON.parse ( text [ , reviver ] )
8
9 [...]
10 7. If IsCallable(reviver) is true, then
11 [...]
12 e. Return ? InternalizeJSONProperty(root, rootName).
13
14 Runtime Semantics: InternalizeJSONProperty ( holder, name)
15
16 1. Let val be ? Get(holder, name).
17 ---*/
18
19 var thrower = function() {
20 throw new Test262Error();
21 };
22
23 assert.throws(Test262Error, function() {
24 JSON.parse('[0,0]', function() {
25 Object.defineProperty(this, '1', {
26 get: thrower
27 });
28 });
29 });
30
31 reportCompare(0, 0);