summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-setInstrumentation-04.js
blob: 0e86eb90969c16c62af581e49f9035648352c74c (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
31
32
33
34
// Test that instrumenting a function does not interfere with script
// disassembly when reporting errors.

var g = newGlobal({ newCompartment: true });
var dbg = Debugger(g);
var gdbg = dbg.addDebuggee(g);

function setScriptId(script) {
  script.setInstrumentationId(0);
  script.getChildScripts().forEach(setScriptId);
}

dbg.onNewScript = setScriptId;

const executedLines = [];
gdbg.setInstrumentation(
  gdbg.makeDebuggeeValue(() => {}),
  ["breakpoint"]
);

g.eval(`
function foo(v) {
  v.f().g();
}
`);

var gotException = false;
try {
  g.foo({ f: () => { return { g: 0 } } });
} catch (e) {
  gotException = true;
  assertEq(e.toString().includes("v.f().g is not a function"), true);
}
assertEq(gotException, true);