Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 // |jit-test| debug
2 // Don't allow cycles in the graph of the compartment "debugs" relation.
4 load(libdir + "asserts.js");
6 // trivial cycles
7 var dbg = new Debugger;
8 assertThrowsInstanceOf(function () { dbg.addDebuggee(this); }, TypeError);
9 assertThrowsInstanceOf(function () { new Debugger(this); }, TypeError);
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);
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);