reviver-object-delete-err.js (1187B)
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 object property deletion 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 2. If Type(val) is Object, then 18 a. Let isArray be ? IsArray(val). 19 b. If isArray is true, then 20 [...] 21 c. Else, 22 i. Let keys be ? EnumerableOwnProperties(val, "key"). 23 ii. For each String P in keys do, 24 1. Let newElement be ? InternalizeJSONProperty(val, P). 25 2. If newElement is undefined, then 26 a. Perform ? val.[[Delete]](P). 27 features: [Proxy] 28 ---*/ 29 30 var badDelete = new Proxy({ 31 a: 1 32 }, { 33 deleteProperty: function() { 34 throw new Test262Error(); 35 } 36 }); 37 38 assert.throws(Test262Error, function() { 39 JSON.parse('[0,0]', function() { 40 this[1] = badDelete; 41 }); 42 }); 43 44 reportCompare(0, 0);