tor-browser

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

bug1448582-6.js (817B)


      1 // Overview:
      2 // - The outer function is an IIFE which gets marked as a singleton.
      3 // - The |o[index]| inner function is then also marked as a singleton.
      4 // - The |o[index]| inner function has a dynamic name from a computed property name.
      5 // - The |self| inner function uses |Function.prototype.caller| to reinvoke the outer function.
      6 
      7 (function(index) {
      8    var o = {
      9        [index]: class {
     10            constructor() {}
     11 
     12            // The static method named "name" is added after assigning the
     13            // inferred name.
     14            static [(index === 0 ? "not-name" : "name")]() {}
     15        }
     16    }
     17 
     18    // The inferred name matches the current index.
     19    assertEq(displayName(o[index]), String(index));
     20 
     21    if (index === 0) {
     22        (function self() {
     23            self.caller(1);
     24        })();
     25    }
     26 })(0);