reviver = function(p, v) {
if (p == "a") {
this.b = { get x() {return null}, set x(_){throw 666} }
}
return v;
}
JSON.parse('{"a":0,"b":1}', reviver);
According to the spec, when calling InternalizeJSONProperty({a: 0, b: { get x() {return null}, set x(_){throw 666} }}, 'b', reviver, 1)
// According step 5.
val = { get x() {return null}, set x(_){throw 666} }
// According step 6.c
// This will fail, NumberLiteral Parse Node is not ObjectLiteral Parse Node.
Assert(1 is ObjectLiteral Parse Node)
Consider the example below:
According to the spec, when calling
InternalizeJSONProperty({a: 0, b: { get x() {return null}, set x(_){throw 666} }}, 'b', reviver, 1)