value-object-proxy-revoked.js (959B)
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-serializejsonobject 5 description: > 6 Revoked object 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 [...] 18 c. Return ? SerializeJSONObject(value). 19 20 SerializeJSONObject ( value ) 21 22 [...] 23 6. Else, 24 a. Let K be ? EnumerableOwnPropertyNames(value, "key"). 25 features: [Proxy] 26 ---*/ 27 28 var handle = Proxy.revocable({}, {}); 29 30 handle.revoke(); 31 32 assert.throws(TypeError, function() { 33 JSON.stringify(handle.proxy); 34 }, 'top-level value'); 35 36 assert.throws(TypeError, function() { 37 JSON.stringify({a: {b: handle.proxy}}); 38 }, 'nested value'); 39 40 reportCompare(0, 0);