reviver-array-delete-err.js (1205B)
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 array 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 i. Set I to 0. 21 ii. Let len be ? ToLength(? Get(val, "length")). 22 iii. Repeat while I < len, 23 1. Let newElement be ? InternalizeJSONProperty(val, ! 24 ToString(I)). 25 2. If newElement is undefined, then 26 a. Perform ? val.[[Delete]](! ToString(I)). 27 features: [Proxy] 28 ---*/ 29 30 var badDelete = new Proxy([0], { 31 deleteProperty: function() { 32 throw new Test262Error(); 33 } 34 }); 35 36 assert.throws(Test262Error, function() { 37 JSON.parse('[0,0]', function() { 38 this[1] = badDelete; 39 }); 40 }); 41 42 reportCompare(0, 0);