Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/has/trap-is-missing-target-is-proxy.js

raw
1 // Copyright (C) 2020 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p
6 description: >
7 If "has" trap is null or undefined, [[HasProperty]] call is properly
8 forwarded to [[ProxyTarget]] (which is also a Proxy object).
9 info: |
10 [[HasProperty]] ( P )
11
12 [...]
13 5. Let target be O.[[ProxyTarget]].
14 6. Let trap be ? GetMethod(handler, "has").
15 7. If trap is undefined, then
16 a. Return ? target.[[HasProperty]](P).
17 features: [Proxy, Symbol.replace, Reflect]
18 ---*/
19
20 var regExp = /(?:)/m;
21 var regExpTarget = new Proxy(regExp, {});
22 var regExpProxy = new Proxy(regExpTarget, {});
23
24 assert(Reflect.has(regExpProxy, "ignoreCase"));
25 assert(Symbol.replace in regExpProxy);
26 assert("lastIndex" in Object.create(regExpProxy));
27
28
29 var functionTarget = new Proxy(function() {}, {});
30 var functionProxy = new Proxy(functionTarget, {});
31
32 assert("name" in functionProxy);
33 assert("length" in Object.create(functionProxy));
34
35 reportCompare(0, 0);