summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-debuggees-06.js
blob: 39e00f4848365324cdd1a75eea540856171f0144 (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
// {has,add,remove}Debuggee throw a TypeError if the argument is invalid.

load(libdir + "asserts.js");

var dbg = new Debugger;

function check(val) {
    assertThrowsInstanceOf(function () { dbg.hasDebuggee(val); }, TypeError);
    assertThrowsInstanceOf(function () { dbg.addDebuggee(val); }, TypeError);
    assertThrowsInstanceOf(function () { dbg.removeDebuggee(val); }, TypeError);
}

// Primitive values are invalid.
check(undefined);
check(null);
check(false);
check(1);
check(NaN);
check("ok");
check(Symbol("ok"));

// A Debugger.Object that belongs to a different Debugger object is invalid.
var g = newGlobal();
var dbg2 = new Debugger;
var w = dbg2.addDebuggee(g);
assertEq(w instanceof Debugger.Object, true);
check(w);