|
1 // {has,add,remove}Debuggee throw a TypeError if the argument is invalid. |
|
2 |
|
3 load(libdir + "asserts.js"); |
|
4 |
|
5 var dbg = new Debugger; |
|
6 |
|
7 function check(val) { |
|
8 assertThrowsInstanceOf(function () { dbg.hasDebuggee(val); }, TypeError); |
|
9 assertThrowsInstanceOf(function () { dbg.addDebuggee(val); }, TypeError); |
|
10 assertThrowsInstanceOf(function () { dbg.removeDebuggee(val); }, TypeError); |
|
11 } |
|
12 |
|
13 // Primitive values are invalid. |
|
14 check(undefined); |
|
15 check(null); |
|
16 check(false); |
|
17 check(1); |
|
18 check(NaN); |
|
19 check("ok"); |
|
20 |
|
21 // A Debugger.Object that belongs to a different Debugger object is invalid. |
|
22 var g = newGlobal(); |
|
23 var dbg2 = new Debugger; |
|
24 var w = dbg2.addDebuggee(g); |
|
25 assertEq(w instanceof Debugger.Object, true); |
|
26 check(w); |