Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/getOwnPropertyDescriptor/call-parameters.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 9.5.5
5 description: >
6 Trap is called with hander context and parameters are target and P
7 info: |
8 [[GetOwnProperty]] (P)
9
10 ...
11 9. Let trapResultObj be Call(trap, handler, «target, P»).
12 ...
13 features: [Proxy]
14 ---*/
15
16 var _target, _handler, _prop;
17 var target = {
18 attr: 1
19 };
20 var handler = {
21 getOwnPropertyDescriptor: function(t, prop) {
22 _target = t;
23 _handler = this;
24 _prop = prop;
25
26 return Object.getOwnPropertyDescriptor(t, prop);
27 }
28 };
29 var p = new Proxy(target, handler);
30
31 Object.getOwnPropertyDescriptor(p, "attr");
32
33 assert.sameValue(_handler, handler);
34 assert.sameValue(_target, target);
35 assert.sameValue(_prop, "attr");
36
37 reportCompare(0, 0);