summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/onNewScript-CloneAndExecuteScript.js
blob: 9e56ce920e8576c1cc94fb272e412b32d3c175ce (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
// Debugger should be notified of scripts created with cloneAndExecuteScript.

var g = newGlobal();
var g2 = newGlobal();
var dbg = new Debugger(g, g2);
var log = '';

dbg.onNewScript = function (evalScript) {
  log += 'e';

  dbg.onNewScript = function (clonedScript) {
    log += 'c';
    clonedScript.setBreakpoint(0, {
      hit(frame) {
        log += 'b';
        assertEq(frame.script, clonedScript);
      }
    });
  };
};

dbg.onDebuggerStatement = function (frame) {
  log += 'd';
};

assertEq(log, '');
g.cloneAndExecuteScript("debugger; // nee", g2);
assertEq(log, 'ecbd');