tor-browser

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

value-array-proxy-revoked.js (977B)


      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.stringify
      5 description: >
      6  Revoked array proxy value produces a TypeError.
      7 info: |
      8  JSON.stringify ( value [ , replacer [ , space ] ] )
      9 
     10  [...]
     11  12. Return ? SerializeJSONProperty(the empty String, wrapper).
     12 
     13  SerializeJSONProperty ( key, holder )
     14 
     15  [...]
     16  10. If Type(value) is Object and IsCallable(value) is false, then
     17    a. Let isArray be ? IsArray(value).
     18 
     19  IsArray ( argument )
     20 
     21  [...]
     22  3. If argument is a Proxy exotic object, then
     23    a. If argument.[[ProxyHandler]] is null, throw a TypeError exception.
     24 features: [Proxy]
     25 ---*/
     26 
     27 var handle = Proxy.revocable([], {});
     28 
     29 handle.revoke();
     30 
     31 assert.throws(TypeError, function() {
     32  JSON.stringify(handle.proxy);
     33 }, 'top-level value');
     34 
     35 assert.throws(TypeError, function() {
     36  JSON.stringify([[[handle.proxy]]]);
     37 }, 'nested value');
     38 
     39 reportCompare(0, 0);