summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-debuggees-08.js
blob: 4793e49eaf309f20fbc21e5bf79f653f5aa67d16 (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
// Adding a debuggee more than once is redundant.

var dbg = new Debugger;
var g = newGlobal({newCompartment: true});
var w = dbg.addDebuggee(g);
assertEq(w instanceof Debugger.Object, true);

function usual() {
    assertEq(dbg.hasDebuggee(g), true);
    assertEq(dbg.hasDebuggee(w), true);
    var arr = dbg.getDebuggees();
    assertEq(arr.length, 1);
    assertEq(arr[0], w);
}

usual();
assertEq(dbg.addDebuggee(g), w);
usual();
assertEq(dbg.addDebuggee(w), w);
usual();

// Removing the debuggee once is enough.
assertEq(dbg.removeDebuggee(g), undefined);
assertEq(dbg.hasDebuggee(g), false);
assertEq(dbg.getDebuggees().length, 0);