| 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 |
`.. in Object.create(proxy)` triggers trap.call(handler, target, P); |
| 7 |
info: | |
| 8 |
[[HasProperty]] (P) |
| 9 |
|
| 10 |
... |
| 11 |
2. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 12 |
... |
| 13 |
5. Let target be the value of the [[ProxyTarget]] internal slot of O. |
| 14 |
6. Let trap be GetMethod(handler, "has"). |
| 15 |
... |
| 16 |
9. Let booleanTrapResult be ToBoolean(Call(trap, handler, «target, P»)). |
| 17 |
... |
| 18 |
---*/ |
| 19 |
|
| 20 |
var _handler, _target, _prop; |
| 21 |
var target = {}; |
| 22 |
var handler = { |
| 23 |
has: function(t, prop) { |
| 24 |
_handler = this; |
| 25 |
_target = t; |
| 26 |
_prop = prop; |
| 27 |
|
| 28 |
return false; |
| 29 |
} |
| 30 |
}; |
| 31 |
var p = new Proxy(target, handler); |
| 32 |
|
| 33 |
"attr" in Object.create(p); |
| 34 |
|
| 35 |
assert.sameValue(_handler, handler, "handler is context"); |
| 36 |
assert.sameValue(_target, target, "target is the first parameter"); |
| 37 |
assert.sameValue(_prop, "attr", "given prop is the second paramter"); |