js/src/jit-test/tests/debug/Debugger-ctor-01.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-ctor-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,21 @@
     1.4 +load(libdir + 'asserts.js');
     1.5 +
     1.6 +// Debugger rejects arguments that aren't cross-compartment wrappers.
     1.7 +assertThrowsInstanceOf(function () { Debugger(null); }, TypeError);
     1.8 +assertThrowsInstanceOf(function () { Debugger(true); }, TypeError);
     1.9 +assertThrowsInstanceOf(function () { Debugger(42); }, TypeError);
    1.10 +assertThrowsInstanceOf(function () { Debugger("bad"); }, TypeError);
    1.11 +assertThrowsInstanceOf(function () { Debugger(function () {}); }, TypeError);
    1.12 +assertThrowsInstanceOf(function () { Debugger(this); }, TypeError);
    1.13 +assertThrowsInstanceOf(function () { new Debugger(null); }, TypeError);
    1.14 +assertThrowsInstanceOf(function () { new Debugger(true); }, TypeError);
    1.15 +assertThrowsInstanceOf(function () { new Debugger(42); }, TypeError);
    1.16 +assertThrowsInstanceOf(function () { new Debugger("bad"); }, TypeError);
    1.17 +assertThrowsInstanceOf(function () { new Debugger(function () {}); }, TypeError);
    1.18 +assertThrowsInstanceOf(function () { new Debugger(this); }, TypeError);
    1.19 +
    1.20 +// From the main compartment, creating a Debugger on a sandbox compartment.
    1.21 +var g = newGlobal();
    1.22 +var dbg = new Debugger(g);
    1.23 +assertEq(dbg instanceof Debugger, true);
    1.24 +assertEq(Object.getPrototypeOf(dbg), Debugger.prototype);

mercurial