tor-browser

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

bug1448582-4.js (708B)


      1 // Overview:
      2 // - The outer function is an IIFE which gets marked as a singleton.
      3 // - The |fn| inner function is then also marked as a singleton.
      4 // - The |self| inner function uses |Function.prototype.caller| to reinvoke the outer function.
      5 //
      6 // When we reinvoke outer, we end up cloning a previously reused, i.e. non-cloned,
      7 // function.
      8 
      9 (function(index) {
     10    var fn = function(a) {};
     11 
     12    // Accessing |.length| sets the resolved-length flag, which should not be
     13    // copied over to the function clone.
     14    assertEq(fn.length, 1);
     15 
     16    // Reinvoke the IIFE through |Function.prototype.caller|.
     17    if (index === 0) {
     18        (function self() {
     19            self.caller(1);
     20        })();
     21    }
     22 })(0);