js/src/jit-test/tests/debug/Debugger-debuggees-11.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Debugger-debuggees-11.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +// |jit-test| debug
     1.5 +// Don't allow cycles in the graph of the compartment "debugs" relation.
     1.6 +
     1.7 +load(libdir + "asserts.js");
     1.8 +
     1.9 +// trivial cycles
    1.10 +var dbg = new Debugger;
    1.11 +assertThrowsInstanceOf(function () { dbg.addDebuggee(this); }, TypeError);
    1.12 +assertThrowsInstanceOf(function () { new Debugger(this); }, TypeError);
    1.13 +
    1.14 +// cycles of length 2
    1.15 +var d1 = newGlobal();
    1.16 +d1.top = this;
    1.17 +d1.eval("var dbg = new Debugger(top)");
    1.18 +assertThrowsInstanceOf(function () { dbg.addDebuggee(d1); }, TypeError);
    1.19 +assertThrowsInstanceOf(function () { new Debugger(d1); }, TypeError);
    1.20 +
    1.21 +// cycles of length 3
    1.22 +var d2 = newGlobal();
    1.23 +d2.top = this;
    1.24 +d2.eval("var dbg = new Debugger(top.d1)");
    1.25 +assertThrowsInstanceOf(function () { dbg.addDebuggee(d2); }, TypeError);
    1.26 +assertThrowsInstanceOf(function () { new Debugger(d2); }, TypeError);

mercurial