Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/getOwnPropertyDescriptor/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-getownproperty-p
6 description: >
7 If "getOwnPropertyDescriptor" trap is null or undefined, [[GetOwnProperty]]
8 call is properly forwarded to [[ProxyTarget]] (which is also a Proxy object).
9 info: |
10 [[GetOwnProperty]] ( P )
11
12 [...]
13 5. Let target be O.[[ProxyTarget]].
14 6. Let trap be ? GetMethod(handler, "getOwnPropertyDescriptor").
15 7. If trap is undefined, then
16 a. Return ? target.[[GetOwnProperty]](P).
17 includes: [propertyHelper.js]
18 features: [Proxy]
19 ---*/
20
21 var stringTarget = new Proxy(new String("str"), {});
22 var stringProxy = new Proxy(stringTarget, {});
23
24 verifyProperty(stringProxy, "0", {
25 value: "s",
26 writable: false,
27 enumerable: true,
28 configurable: false,
29 });
30
31 verifyProperty(stringProxy, "length", {
32 value: 3,
33 writable: false,
34 enumerable: false,
35 configurable: false,
36 });
37
38
39 var functionTarget = new Proxy(function() {}, {});
40 var functionProxy = new Proxy(functionTarget, {});
41
42 verifyProperty(functionProxy, "prototype", {
43 writable: true,
44 enumerable: false,
45 configurable: false,
46 });
47
48 reportCompare(0, 0);