tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

reviver-object-own-keys-err.js (966B)


      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 enumeration 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 features: [Proxy]
     24 ---*/
     25 
     26 var badKeys = new Proxy({}, {
     27  ownKeys: function() {
     28    throw new Test262Error();
     29  }
     30 });
     31 
     32 assert.throws(Test262Error, function() {
     33  JSON.parse('[0,0]', function() {
     34    this[1] = badKeys;
     35  });
     36 });
     37 
     38 reportCompare(0, 0);