|
1 // addDebuggee, hasDebuggee, and removeDebuggee all throw if presented with |
|
2 // objects that are not valid global object designators. |
|
3 |
|
4 load(libdir + 'asserts.js'); |
|
5 |
|
6 var dbg = new Debugger; |
|
7 |
|
8 function check(bad) { |
|
9 print("check(" + uneval(bad) + ")"); |
|
10 assertThrowsInstanceOf(function () { dbg.addDebuggee(bad); }, TypeError); |
|
11 assertEq(dbg.getDebuggees().length, 0); |
|
12 assertThrowsInstanceOf(function () { dbg.hasDebuggee(bad); }, TypeError); |
|
13 assertThrowsInstanceOf(function () { dbg.removeDebuggee(bad); }, TypeError); |
|
14 } |
|
15 |
|
16 var g = newGlobal(); |
|
17 check(g.Object()); |
|
18 check(g.Object); |
|
19 check(g.Function("")); |
|
20 |
|
21 // A Debugger.Object belonging to a different Debugger is not a valid way |
|
22 // to designate a global, even if its referent is a global. |
|
23 var g2 = newGlobal(); |
|
24 var dbg2 = new Debugger; |
|
25 var d2g2 = dbg2.addDebuggee(g2); |
|
26 check(d2g2); |