Frame-evalWithBindings-14.js (776B)
1 var g = newGlobal({newCompartment: true}); 2 var dbg = new Debugger(g); 3 // We're going to need to eval with a thrown exception from inside 4 // onExceptionUnwind, so guard against infinite recursion. 5 var exceptionCount = 0; 6 dbg.onDebuggerStatement = function (frame) { 7 var x = frame.evalWithBindings("throw 'haha'", { rightSpelling: 4 }).throw; 8 assertEq(x, "haha"); 9 }; 10 dbg.onExceptionUnwind = function (frame, exc) { 11 ++exceptionCount; 12 if (exceptionCount == 1) { 13 var y = frame.evalWithBindings("throw 'haha2'", { rightSpelling: 2 }).throw; 14 assertEq(y, "haha2"); 15 } else { 16 assertEq(frame.evalWithBindings("rightSpelling + three", { three : 3 }).return, 5); 17 } 18 }; 19 g.eval("(function () { var rightSpelling = 7; debugger; })();"); 20 assertEq(exceptionCount, 2);