summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/bug-1477084.js
blob: 2e45a8cc05983516a091f38a91b45d65b12f3ab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Don't assert trying to force return before the initial yield of an async function.

var g = newGlobal({newCompartment: true});
g.parent = this;
g.parentExc = new Error("pants");
g.eval(`
  var dbg = new Debugger;
  var pw = dbg.addDebuggee(parent);
  var hits = 0;
  dbg.onExceptionUnwind = function (frame) {
    dbg.onExceptionUnwind = undefined;
    return {return: undefined};
  };
  dbg.uncaughtExceptionHook = exc => {
    hits++;
    assertEq(exc instanceof TypeError, true);
    assertEq(/force return.*before the initial yield/.test(exc.message), true);
    return {throw: pw.makeDebuggeeValue(parentExc)};
  };
`);

async function* method({ x: callbackfn = unresolvableReference }) {}
try {
  method();
} catch (exc) {
  g.dbg.enabled = false;
  assertEq(exc, g.parentExc);
}

assertEq(g.hits, 1);