michael@0: // Basic onExceptionUnwind hook test. michael@0: michael@0: load(libdir + "asserts.js"); michael@0: michael@0: var g = newGlobal(); michael@0: var dbg = Debugger(g); michael@0: var hit = false; michael@0: dbg.onExceptionUnwind = function (frame, exc) { michael@0: // onExceptionUnwind is called multiple times as the stack is unwound. michael@0: // Only check the first hit. michael@0: assertEq(arguments.length, 2); michael@0: assertEq(frame instanceof Debugger.Frame, true); michael@0: if (!hit) { michael@0: assertEq(exc, 101); michael@0: assertEq(frame.type, "call"); michael@0: assertEq(frame.callee.name, "f"); michael@0: assertEq(frame.older.type, "eval"); michael@0: hit = true; michael@0: } michael@0: }; michael@0: michael@0: g.eval("function f() { throw 101; }"); michael@0: assertThrowsValue(function () { g.eval("f();"); }, 101); michael@0: assertEq(hit, true);