js/src/jit-test/tests/debug/Object-evalInGlobal-02.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/Object-evalInGlobal-02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +// Debugger.Object.prototype.evalInGlobal argument validation
     1.5 +
     1.6 +load(libdir + 'asserts.js');
     1.7 +
     1.8 +var g = newGlobal();
     1.9 +var dbg = new Debugger();
    1.10 +var gw = dbg.addDebuggee(g);
    1.11 +var gobj = gw.makeDebuggeeValue(g.eval("({})"));
    1.12 +
    1.13 +assertThrowsInstanceOf(function () { gw.evalInGlobal(); }, TypeError);
    1.14 +assertThrowsInstanceOf(function () { gw.evalInGlobal(10); }, TypeError);
    1.15 +assertThrowsInstanceOf(function () { gobj.evalInGlobal('42'); }, TypeError);
    1.16 +assertEq(gw.evalInGlobal('42').return, 42);
    1.17 +
    1.18 +assertThrowsInstanceOf(function () { gw.evalInGlobalWithBindings(); }, TypeError);
    1.19 +assertThrowsInstanceOf(function () { gw.evalInGlobalWithBindings('42'); }, TypeError);
    1.20 +assertThrowsInstanceOf(function () { gw.evalInGlobalWithBindings(10, 1729); }, TypeError);
    1.21 +assertThrowsInstanceOf(function () { gw.evalInGlobalWithBindings('42', 1729); }, TypeError);
    1.22 +assertThrowsInstanceOf(function () { gobj.evalInGlobalWithBindings('42', {}); }, TypeError);
    1.23 +assertEq(gw.evalInGlobalWithBindings('42', {}).return, 42);

mercurial