tor-browser

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

Debugger-findSources-02.js (620B)


      1 // In a debugger with scripts, findSources finds the script source.
      2 
      3 const g = newGlobal({newCompartment: true});
      4 // Declare a function in order to keep the script source alive across GC.
      5 g.evaluate(`function fa() {}`, { fileName: "a.js" });
      6 g.evaluate(`function fb() {}`, { fileName: "b.js" });
      7 g.evaluate(`function fc() {}`, { fileName: "c.js" });
      8 
      9 const dbg = new Debugger();
     10 const gw = dbg.addDebuggee(g);
     11 
     12 const sources = dbg.findSources();
     13 assertEq(sources.filter(s => s.url == "a.js").length, 1);
     14 assertEq(sources.filter(s => s.url == "b.js").length, 1);
     15 assertEq(sources.filter(s => s.url == "c.js").length, 1);