1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Debugger-debuggees-06.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +// {has,add,remove}Debuggee throw a TypeError if the argument is invalid. 1.5 + 1.6 +load(libdir + "asserts.js"); 1.7 + 1.8 +var dbg = new Debugger; 1.9 + 1.10 +function check(val) { 1.11 + assertThrowsInstanceOf(function () { dbg.hasDebuggee(val); }, TypeError); 1.12 + assertThrowsInstanceOf(function () { dbg.addDebuggee(val); }, TypeError); 1.13 + assertThrowsInstanceOf(function () { dbg.removeDebuggee(val); }, TypeError); 1.14 +} 1.15 + 1.16 +// Primitive values are invalid. 1.17 +check(undefined); 1.18 +check(null); 1.19 +check(false); 1.20 +check(1); 1.21 +check(NaN); 1.22 +check("ok"); 1.23 + 1.24 +// A Debugger.Object that belongs to a different Debugger object is invalid. 1.25 +var g = newGlobal(); 1.26 +var dbg2 = new Debugger; 1.27 +var w = dbg2.addDebuggee(g); 1.28 +assertEq(w instanceof Debugger.Object, true); 1.29 +check(w);