michael@0: // Basic enterFrame hook tests. michael@0: michael@0: var g = newGlobal(); michael@0: var dbg = Debugger(g); michael@0: var type; michael@0: dbg.onEnterFrame = function (frame) { michael@0: try { michael@0: assertEq(frame instanceof Debugger.Frame, true); michael@0: assertEq(frame.live, true); michael@0: type = frame.type; michael@0: } catch (exc) { michael@0: type = "Exception thrown: " + exc; michael@0: } michael@0: }; michael@0: michael@0: function test(f, expected) { michael@0: type = undefined; michael@0: f(); michael@0: assertEq(type, expected); michael@0: } michael@0: michael@0: // eval triggers the hook michael@0: test(function () { g.eval("function h() { return 1; }"); }, "eval"); michael@0: michael@0: // function calls trigger it michael@0: test(function () { assertEq(g.h(), 1); }, "call"); michael@0: michael@0: // global scripts trigger it michael@0: test(function () { g.evaluate("var x = 5;"); assertEq(g.x, 5); }, "global");