michael@0: // |jit-test| debug michael@0: // Don't allow cycles in the graph of the compartment "debugs" relation. michael@0: michael@0: load(libdir + "asserts.js"); michael@0: michael@0: // trivial cycles michael@0: var dbg = new Debugger; michael@0: assertThrowsInstanceOf(function () { dbg.addDebuggee(this); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Debugger(this); }, TypeError); michael@0: michael@0: // cycles of length 2 michael@0: var d1 = newGlobal(); michael@0: d1.top = this; michael@0: d1.eval("var dbg = new Debugger(top)"); michael@0: assertThrowsInstanceOf(function () { dbg.addDebuggee(d1); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Debugger(d1); }, TypeError); michael@0: michael@0: // cycles of length 3 michael@0: var d2 = newGlobal(); michael@0: d2.top = this; michael@0: d2.eval("var dbg = new Debugger(top.d1)"); michael@0: assertThrowsInstanceOf(function () { dbg.addDebuggee(d2); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Debugger(d2); }, TypeError);