diff options
Diffstat (limited to 'js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js')
-rw-r--r-- | js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js b/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js new file mode 100644 index 000000000..8b9419913 --- /dev/null +++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js @@ -0,0 +1,27 @@ +// evalWithBindings code is debuggee code, so it can trip the debugger. It nests! +var g = newGlobal(); +var dbg = new Debugger(g); +var f1; +var hits = 0; +dbg.onDebuggerStatement = function (frame) { + f1 = frame; + + // This trips the onExceptionUnwind hook. + var x = frame.evalWithBindings("wrongSpeling", {rightSpelling: 2}).throw; + + assertEq(frame.evalWithBindings("exc.name", {exc: x}).return, "ReferenceError"); + hits++; +}; +dbg.onExceptionUnwind = function (frame, exc) { + assertEq(frame !== f1, true); + + // f1's environment does not contain the binding for the first evalWithBindings call. + assertEq(f1.eval("rightSpelling").return, "dependent"); + assertEq(f1.evalWithBindings("n + rightSpelling", {n: "in"}).return, "independent"); + + // frame's environment does contain the binding. + assertEq(frame.eval("rightSpelling").return, 2); + assertEq(frame.evalWithBindings("rightSpelling + three", {three: 3}).return, 5); + hits++; +}; +g.eval("(function () { var rightSpelling = 'dependent'; debugger; })();"); |