diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/debug/Object-evalInGlobal-02.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/debug/Object-evalInGlobal-02.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,20 @@ +// Debugger.Object.prototype.evalInGlobal argument validation + +load(libdir + 'asserts.js'); + +var g = newGlobal(); +var dbg = new Debugger(); +var gw = dbg.addDebuggee(g); +var gobj = gw.makeDebuggeeValue(g.eval("({})")); + +assertThrowsInstanceOf(function () { gw.evalInGlobal(); }, TypeError); +assertThrowsInstanceOf(function () { gw.evalInGlobal(10); }, TypeError); +assertThrowsInstanceOf(function () { gobj.evalInGlobal('42'); }, TypeError); +assertEq(gw.evalInGlobal('42').return, 42); + +assertThrowsInstanceOf(function () { gw.evalInGlobalWithBindings(); }, TypeError); +assertThrowsInstanceOf(function () { gw.evalInGlobalWithBindings('42'); }, TypeError); +assertThrowsInstanceOf(function () { gw.evalInGlobalWithBindings(10, 1729); }, TypeError); +assertThrowsInstanceOf(function () { gw.evalInGlobalWithBindings('42', 1729); }, TypeError); +assertThrowsInstanceOf(function () { gobj.evalInGlobalWithBindings('42', {}); }, TypeError); +assertEq(gw.evalInGlobalWithBindings('42', {}).return, 42);