tor-browser

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

testDirectProxySetInherited.js (563B)


      1 // When assigning to an object with a proxy is on the prototype chain,
      2 // the proxy's set handler is called.
      3 
      4 var C = {};
      5 var B = new Proxy(C, {
      6    get() { throw "FAIL"; },
      7    getOwnPropertyDescriptor() { throw "FAIL"; },
      8    has() { throw "FAIL"; },
      9    defineProperty() { throw "FAIL"; },
     10    set(target, id, value, receiver) {
     11        hits++;
     12        assertEq(target, C);
     13        assertEq(id, "x");
     14        assertEq(value, 3);
     15        assertEq(receiver, A);
     16        return true;
     17    }
     18 });
     19 var A = Object.create(B);
     20 
     21 var hits = 0;
     22 A.x = 3;
     23 assertEq(hits, 1);