|
1 // |jit-test| debug |
|
2 // Don't allow cycles in the graph of the compartment "debugs" relation. |
|
3 |
|
4 load(libdir + "asserts.js"); |
|
5 |
|
6 // trivial cycles |
|
7 var dbg = new Debugger; |
|
8 assertThrowsInstanceOf(function () { dbg.addDebuggee(this); }, TypeError); |
|
9 assertThrowsInstanceOf(function () { new Debugger(this); }, TypeError); |
|
10 |
|
11 // cycles of length 2 |
|
12 var d1 = newGlobal(); |
|
13 d1.top = this; |
|
14 d1.eval("var dbg = new Debugger(top)"); |
|
15 assertThrowsInstanceOf(function () { dbg.addDebuggee(d1); }, TypeError); |
|
16 assertThrowsInstanceOf(function () { new Debugger(d1); }, TypeError); |
|
17 |
|
18 // cycles of length 3 |
|
19 var d2 = newGlobal(); |
|
20 d2.top = this; |
|
21 d2.eval("var dbg = new Debugger(top.d1)"); |
|
22 assertThrowsInstanceOf(function () { dbg.addDebuggee(d2); }, TypeError); |
|
23 assertThrowsInstanceOf(function () { new Debugger(d2); }, TypeError); |