Debian Codegraph @

js/src/tests/test262/built-ins/JSON/stringify/replacer-array-proxy-revoked.js

raw
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: Revoked proxy value produces a TypeError.
6 info: |
7 [...]
8 4. If Type(replacer) is Object, then
9 a. If IsCallable(replacer) is true, then
10 i. Let ReplacerFunction be replacer.
11 b. Else,
12 i. Let isArray be ? IsArray(replacer).
13
14 7.2.2 IsArray
15
16 [...]
17 3. If argument is a Proxy exotic object, then
18 a. If the value of the [[ProxyHandler]] internal slot of argument is null,
19 throw a TypeError exception.
20 b. Let target be the value of the [[ProxyTarget]] internal slot of
21 argument.
22 c. Return ? IsArray(target).
23 features: [Proxy]
24 ---*/
25
26 var handle = Proxy.revocable([], {});
27
28 handle.revoke();
29
30 assert.throws(TypeError, function() {
31 JSON.stringify({}, handle.proxy);
32 });
33
34 reportCompare(0, 0);