tor-browser

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

revived-proxy-revoked.js (1335B)


      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-json.parse
      5 description: Behavior when revived value is a revoked Proxy exotic object
      6 info: |
      7  [...]
      8  7. If IsCallable(reviver) is true, then
      9     a. Let root be ObjectCreate(%ObjectPrototype%).
     10     b. Let rootName be the empty String.
     11     c. Let status be CreateDataProperty(root, rootName, unfiltered).
     12     d. Assert: status is true.
     13     e. Return ? InternalizeJSONProperty(root, rootName).
     14 
     15  24.3.1.1 Runtime Semantics: InternalizeJSONProperty
     16 
     17  [...]
     18  2. If Type(val) is Object, then
     19     a. Let isArray be ? IsArray(val).
     20 
     21  7.2.2 IsArray
     22 
     23  [...]
     24  3. If argument is a Proxy exotic object, then
     25     a. If the value of the [[ProxyHandler]] internal slot of argument is null,
     26        throw a TypeError exception.
     27     b. Let target be the value of the [[ProxyTarget]] internal slot of
     28        argument.
     29     c. Return ? IsArray(target).
     30 features: [Proxy]
     31 ---*/
     32 
     33 var handle = Proxy.revocable([], {});
     34 var returnCount = 0;
     35 
     36 handle.revoke();
     37 
     38 assert.throws(TypeError, function() {
     39  JSON.parse('[null, null]', function() {
     40    this[1] = handle.proxy;
     41    returnCount += 1;
     42  });
     43 });
     44 
     45 assert.sameValue(returnCount, 1, 'invocation returns normally');
     46 
     47 reportCompare(0, 0);