1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,27 @@ 1.4 +// evalWithBindings code is debuggee code, so it can trip the debugger. It nests! 1.5 +var g = newGlobal(); 1.6 +var dbg = new Debugger(g); 1.7 +var f1; 1.8 +var hits = 0; 1.9 +dbg.onDebuggerStatement = function (frame) { 1.10 + f1 = frame; 1.11 + 1.12 + // This trips the onExceptionUnwind hook. 1.13 + var x = frame.evalWithBindings("wrongSpeling", {rightSpelling: 2}).throw; 1.14 + 1.15 + assertEq(frame.evalWithBindings("exc.name", {exc: x}).return, "ReferenceError"); 1.16 + hits++; 1.17 +}; 1.18 +dbg.onExceptionUnwind = function (frame, exc) { 1.19 + assertEq(frame !== f1, true); 1.20 + 1.21 + // f1's environment does not contain the binding for the first evalWithBindings call. 1.22 + assertEq(f1.eval("rightSpelling").return, "dependent"); 1.23 + assertEq(f1.evalWithBindings("n + rightSpelling", {n: "in"}).return, "independent"); 1.24 + 1.25 + // frame's environment does contain the binding. 1.26 + assertEq(frame.eval("rightSpelling").return, 2); 1.27 + assertEq(frame.evalWithBindings("rightSpelling + three", {three: 3}).return, 5); 1.28 + hits++; 1.29 +}; 1.30 +g.eval("(function () { var rightSpelling = 'dependent'; debugger; })();");