Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/JSON/stringify/replacer-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 es6id: 24.3.2
6 description: Revoked proxy value produces a TypeError
7 info: |
8 [...]
9 4. If Type(replacer) is Object, then
10 a. If IsCallable(replacer) is true, then
11 i. Let ReplacerFunction be replacer.
12 b. Else,
13 i. Let isArray be ? IsArray(replacer).
14
15 7.2.2 IsArray
16
17 [...]
18 3. If argument is a Proxy exotic object, then
19 a. If the value of the [[ProxyHandler]] internal slot of argument is null,
20 throw a TypeError exception.
21 b. Let target be the value of the [[ProxyTarget]] internal slot of
22 argument.
23 c. Return ? IsArray(target).
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 });