michael@0: // When an exception is propagated out of multiple frames, their onPop michael@0: // and onExceptionUnwind handlers are called in the correct order. michael@0: var g = newGlobal(); michael@0: g.eval("function f() { throw 'mud'; }"); michael@0: g.eval("function g() { f(); }"); michael@0: g.eval("function h() { g(); }"); michael@0: g.eval("function i() { h(); }"); michael@0: michael@0: var dbg = new Debugger(g); michael@0: var log; michael@0: function makePopHandler(label) { michael@0: return function handlePop(completion) { michael@0: log += label; michael@0: assertEq(completion.throw, "mud"); michael@0: }; michael@0: } michael@0: dbg.onEnterFrame = function handleEnter(f) { michael@0: log += "(" + f.callee.name; michael@0: f.onPop = makePopHandler(")" + f.callee.name); michael@0: }; michael@0: dbg.onExceptionUnwind = function handleExceptionUnwind(f, x) { michael@0: assertEq(x, 'mud'); michael@0: log += "u" + f.callee.name; michael@0: }; michael@0: log = ''; michael@0: try { michael@0: g.i(); michael@0: } catch (x) { michael@0: log += 'c'; michael@0: assertEq(x, "mud"); michael@0: } michael@0: assertEq(log, "(i(h(g(fuf)fug)guh)hui)ic");