Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/has/call-in.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.7
5 description: >
6 A `in` check trigger trap.call(handler, target, P);
7 info: |
8 [[HasProperty]] (P)
9
10 ...
11 9. Let booleanTrapResult be ToBoolean(Call(trap, handler, «target, P»)).
12 ...
13 features: [Proxy]
14 ---*/
15
16 var _handler, _target, _prop;
17 var target = {};
18 var handler = {
19 has: function(t, prop) {
20 _handler = this;
21 _target = t;
22 _prop = prop;
23
24 return prop in t;
25 }
26 };
27 var p = new Proxy(target, handler);
28
29 "attr" in p;
30
31 assert.sameValue(_handler, handler, "handler is context");
32 assert.sameValue(_target, target, "target is the first parameter");
33 assert.sameValue(_prop, "attr", "given prop is the second paramter");
34
35 reportCompare(0, 0);