tor-browser

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

testDirectProxySet2.js (771B)


      1 /*
      2 * Call the trap with the handler as the this value, the target as the first
      3 * argument, the name of the property as the second argument, the value as the
      4 * third argument, and the receiver as the fourth argument
      5 */
      6 var target = {};
      7 for (var key of ['foo', Symbol.for('quux')]) {
      8    var handler = { };
      9    for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) {
     10        handler.set = function (target1, name, val, receiver) {
     11            assertEq(this, handler);
     12            assertEq(target1, target);
     13            assertEq(name, key);
     14            assertEq(val, 'baz');
     15            assertEq(receiver, p);
     16            called = true;
     17        }
     18 
     19        var called = false;
     20        p[key] = 'baz';
     21        assertEq(called, true);
     22    }
     23 }