tor-browser

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

proto_self.js (735B)


      1 // getprop, proto and self, 3 shapes
      2 
      3 var expected = "22,202,99;202,99,22;99,22,202;22,202,99;202,99,22;99,22,202;22,202,99;202,99,22;99,22,202;";
      4 var actual = '';
      5 
      6 var protoB = { a: 11, b: 22, c: 33 };
      7 
      8 function B() {
      9 }
     10 B.prototype = protoB;
     11 
     12 var protoC = { a: 101, b: 202, c: 303 };
     13 
     14 function C() {
     15 }
     16 C.prototype = protoC;
     17 
     18 function f() {
     19  var o1 = new B();
     20  var o2 = new C();
     21  var o3 = new C();
     22  o3.b = 99;
     23  var oa = [ o1, o2, o3 ];
     24 
     25  for (var i = 0; i < 9; ++i) {
     26    // Use 3 PICs so we start out with each type in one PIC.
     27    var i1 = i % 3;
     28    var i2 = (i+1) % 3;
     29    var i3 = (i+2) % 3;
     30 
     31    actual += oa[i1].b + ',';
     32    actual += oa[i2].b + ',';
     33    actual += oa[i3].b + ';';
     34  }
     35 }
     36 
     37 f();
     38 
     39 assertEq(actual, expected);