tor-browser

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

this-check-after-scalar-replacement-in-derived-class-constructor.js (780B)


      1 // Create a derived class with a default class constructor.
      2 class C extends class {} {}
      3 
      4 // The default constructor of a derived class is small enough to be inlinable.
      5 assertEq(isSmallFunction(C), true);
      6 
      7 // Bound functions have a configurable "prototype" property.
      8 const BF = function(){}.bind();
      9 
     10 function testBoundFunction() {
     11  for (let i = 0; i <= 1000; ++i) {
     12    let newTarget = i < 1000 ? C : BF;
     13    Reflect.construct(C, [], newTarget);
     14  }
     15 }
     16 
     17 for (let i = 0; i < 2; ++i) testBoundFunction();
     18 
     19 // Proxy have a configurable "prototype" property.
     20 const P = new Proxy(function(){}, {});
     21 
     22 function testProxy() {
     23  for (let i = 0; i <= 1000; ++i) {
     24    let newTarget = i < 1000 ? C : P;
     25    Reflect.construct(C, [], newTarget);
     26  }
     27 }
     28 
     29 for (let i = 0; i < 2; ++i) testProxy();