call-object-create.js (1067B)
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 features: [Proxy] 19 ---*/ 20 21 var _handler, _target, _prop; 22 var target = {}; 23 var handler = { 24 has: function(t, prop) { 25 _handler = this; 26 _target = t; 27 _prop = prop; 28 29 return false; 30 } 31 }; 32 var p = new Proxy(target, handler); 33 34 "attr" in Object.create(p); 35 36 assert.sameValue(_handler, handler, "handler is context"); 37 assert.sameValue(_target, target, "target is the first parameter"); 38 assert.sameValue(_prop, "attr", "given prop is the second paramter"); 39 40 reportCompare(0, 0);