tor-browser

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

bug-1477084.js (811B)


      1 // Don't assert trying to force return before the initial yield of an async function.
      2 
      3 var g = newGlobal({newCompartment: true});
      4 g.parent = this;
      5 g.parentExc = new Error("pants");
      6 g.eval(`
      7  var dbg = new Debugger;
      8  var pw = dbg.addDebuggee(parent);
      9  var hits = 0;
     10  dbg.onExceptionUnwind = function (frame) {
     11    dbg.onExceptionUnwind = undefined;
     12    return {return: undefined};
     13  };
     14  dbg.uncaughtExceptionHook = exc => {
     15    hits++;
     16    assertEq(exc instanceof TypeError, true);
     17    assertEq(/force return.*before the initial yield/.test(exc.message), true);
     18    return {throw: pw.makeDebuggeeValue(parentExc)};
     19  };
     20 `);
     21 
     22 async function* method({ x: callbackfn = unresolvableReference }) {}
     23 try {
     24  method();
     25 } catch (exc) {
     26  g.dbg.enabled = false;
     27  assertEq(exc, g.parentExc);
     28 }
     29 
     30 assertEq(g.hits, 1);