tor-browser

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

ExecutionTracer-oom-test.js (785B)


      1 if (typeof enableExecutionTracing == "undefined") {
      2  quit();
      3 }
      4 
      5 
      6 var g = newGlobal({ newCompartment: true });
      7 var dbg = new Debugger();
      8 dbg.addDebuggee(g);
      9 
     10 g.enableExecutionTracing();
     11 
     12 oomTest(function () {
     13  g.eval(`[100].map(function f3(x) { return x; });`);
     14 });
     15 
     16 gc();
     17 
     18 const trace = g.getExecutionTrace();
     19 
     20 g.disableExecutionTracing();
     21 
     22 assertEq(trace.length, 1);
     23 
     24 const events = trace[0].events;
     25 var err = events.find(e => e.kind == "Error");
     26 // Guaranteeing an error is tricky. We don't have a ton of allocations inside
     27 // the tracer to fail, and so with --ion we tend to get skipped over by
     28 // oomTest's iterative failure logic. Accordingly, we just assert that if
     29 // there is an error, it needs to be the last entry.
     30 if (err) {
     31  assertEq(err, events[events.length - 1]);
     32 }