testDirectProxySet1.js (570B)
1 // Forward to the target if the trap is not defined 2 var target = { 3 foo: 'bar' 4 }; 5 for (let p of [new Proxy(target, {}), Proxy.revocable(target, {}).proxy]) { 6 // The sets from the first iteration will affect target, but it doesn't 7 // matter, since the effectiveness of the foo sets is still observable. 8 p.foo = 'baz'; 9 assertEq(target.foo, 'baz'); 10 p['foo'] = 'buz'; 11 assertEq(target.foo, 'buz'); 12 13 var sym = Symbol.for('quux'); 14 p[sym] = sym; 15 assertEq(target[sym], sym); 16 // Reset for second iteration 17 target[sym] = undefined; 18 }