| 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 |
es6id: 24.3.1.1 |
| 6 |
description: Abrupt completion from object property enumeration while reviving |
| 7 |
info: | |
| 8 |
JSON.parse ( text [ , reviver ] ) |
| 9 |
|
| 10 |
[...] |
| 11 |
7. If IsCallable(reviver) is true, then |
| 12 |
[...] |
| 13 |
e. Return ? InternalizeJSONProperty(root, rootName). |
| 14 |
|
| 15 |
Runtime Semantics: InternalizeJSONProperty ( holder, name) |
| 16 |
|
| 17 |
1. Let val be ? Get(holder, name). |
| 18 |
2. If Type(val) is Object, then |
| 19 |
a. Let isArray be ? IsArray(val). |
| 20 |
b. If isArray is true, then |
| 21 |
[...] |
| 22 |
c. Else, |
| 23 |
i. Let keys be ? EnumerableOwnProperties(val, "key"). |
| 24 |
features: [Proxy] |
| 25 |
---*/ |
| 26 |
|
| 27 |
var badKeys = new Proxy({}, { |
| 28 |
ownKeys: function() { |
| 29 |
throw new Test262Error(); |
| 30 |
} |
| 31 |
}); |
| 32 |
|
| 33 |
assert.throws(Test262Error, function() { |
| 34 |
JSON.parse('[0,0]', function() { |
| 35 |
this[1] = badKeys; |
| 36 |
}); |
| 37 |
}); |