tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

testDirectProxyConstruct3.js (397B)


      1 // Return the trap result
      2 function setFoo(x,y) { this.foo = x + y; }
      3 var handler = { construct: function (target, args) { return { foo : args[0] * args[1]}; } }
      4 
      5 for (let proxy of [new Proxy(setFoo, handler), Proxy.revocable(setFoo, handler).proxy]) {
      6    var obj1 = new proxy(2, 3);
      7    assertEq(obj1.foo, 6);
      8    obj1.bar = proxy;
      9    var obj2 = new obj1.bar(2, 3);
     10    assertEq(obj2.foo, 6);
     11 }