tor-browser

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

classConstructor-AnyScripted.js (417B)


      1 function test(fun) {
      2    fun();
      3 }
      4 
      5 // Generate a CallAnyScripted stub in test()
      6 for (let i = 0; i < 20; i++) {
      7    test(function() { /* wheeee */ });
      8 }
      9 
     10 class foo {
     11    constructor() { }
     12 }
     13 
     14 // Compile foo()
     15 for (let i = 0; i < 11; i++)
     16    new foo();
     17 
     18 try {
     19    test(foo);
     20    throw new Error("Invoking a class constructor without new must throw");
     21 } catch (e) {
     22    if (!(e instanceof TypeError))
     23        throw e;
     24 }