tor-browser

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

getprop-cache.js (538B)


      1 function test1() {
      2    function h(node) {
      3        var x = 0.1;
      4        for (var i=0; i<100; i++) {
      5            x += node.parent;
      6        }
      7        return x;
      8    }
      9    function build(depth) {
     10        if (depth > 10)
     11            return {parent: 3.3};
     12        return {__proto__: build(depth + 1)};
     13    }
     14    var tree = build(0);
     15    assertEq(h(tree)|0, 330);
     16 }
     17 test1();
     18 
     19 function test2() {
     20    function Foo() {};
     21    Foo.prototype.x = 3.3;
     22 
     23    var o = new Foo();
     24    for (var i=0; i<100; i++) {
     25        assertEq(o.x, 3.3);
     26    }
     27 }
     28 test2();