1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Environment-setVariable-03.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,16 @@ 1.4 +// setVariable cannot create new global variables. 1.5 +// (Other kinds of environment are tested in Environment-variables.js.) 1.6 + 1.7 +load(libdir + "asserts.js"); 1.8 + 1.9 +var g = newGlobal(); 1.10 +var dbg = new Debugger(g); 1.11 +var hits = 0; 1.12 +dbg.onDebuggerStatement = function (frame) { 1.13 + assertThrowsInstanceOf(function () { frame.environment.setVariable("x", 7); }, TypeError); 1.14 + hits++; 1.15 +}; 1.16 +g.eval("debugger"); 1.17 +assertEq("x" in g, false); 1.18 +assertEq(hits, 1); 1.19 +