js/src/jit-test/tests/debug/Debugger-debuggees-17.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-17.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +// addDebuggee, hasDebuggee, and removeDebuggee all throw if presented with
     1.5 +// objects that are not valid global object designators.
     1.6 +
     1.7 +load(libdir + 'asserts.js');
     1.8 +
     1.9 +var dbg = new Debugger;
    1.10 +
    1.11 +function check(bad) {
    1.12 +  print("check(" + uneval(bad) + ")");
    1.13 +  assertThrowsInstanceOf(function () { dbg.addDebuggee(bad); }, TypeError);
    1.14 +  assertEq(dbg.getDebuggees().length, 0);
    1.15 +  assertThrowsInstanceOf(function () { dbg.hasDebuggee(bad); }, TypeError);
    1.16 +  assertThrowsInstanceOf(function () { dbg.removeDebuggee(bad); }, TypeError);
    1.17 +}
    1.18 +
    1.19 +var g = newGlobal();
    1.20 +check(g.Object());
    1.21 +check(g.Object);
    1.22 +check(g.Function(""));
    1.23 +
    1.24 +// A Debugger.Object belonging to a different Debugger is not a valid way
    1.25 +// to designate a global, even if its referent is a global.
    1.26 +var g2 = newGlobal();
    1.27 +var dbg2 = new Debugger;
    1.28 +var d2g2 = dbg2.addDebuggee(g2);
    1.29 +check(d2g2);

mercurial