testDirectProxyHas2.js (609B)
1 /* 2 * Call the trap with the handler as the this value, the target as the first 3 * argument, and the name of the property as the second argument 4 */ 5 var target = {}; 6 for (var key of ['foo', Symbol('bar')]) { 7 var called; 8 var handler = { 9 has: function (target1, name) { 10 assertEq(this, handler); 11 assertEq(target1, target); 12 assertEq(name, key); 13 called = true; 14 } 15 }; 16 for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) { 17 called = false; 18 key in p; 19 assertEq(called, true); 20 } 21 }