michael@0: g = { 'global noneval': 1 }; michael@0: michael@0: eval("g['global eval'] = 1"); michael@0: michael@0: // Function to step through and set breakpoints on michael@0: function f1() { michael@0: g['function noneval'] = 1; michael@0: eval("g['function eval'] = 1"); michael@0: michael@0: x = 1; michael@0: for (y = 0; y < 10; y++) { michael@0: x++; michael@0: } michael@0: for (y = 0; y < 3; y++) { michael@0: x++; michael@0: } michael@0: z = 3; michael@0: } michael@0: michael@0: var f2 = new Function("g['function noneval'] = 2; eval(\"g['function eval'] = 2\")"); michael@0: michael@0: function testJSD(jsd) { michael@0: ok(jsd.isOn, "JSD needs to be running for this test."); michael@0: michael@0: var numBreakpoints = 0; michael@0: michael@0: f1(); michael@0: f2(); michael@0: jsd.topLevelHook = null; michael@0: jsd.functionHook = null; michael@0: dump("numGlobalNonevals="+numGlobalNonevals+"\n"); michael@0: dump("numFunctionNonevals="+numFunctionNonevals+"\n"); michael@0: dump("numGlobalEvals="+numGlobalEvals+"\n"); michael@0: dump("numFunctionEvals="+numFunctionEvals+"\n"); michael@0: michael@0: ok(numFunctionNonevals == 3, "(fn) Should have hit f1(), testJSD(), and f2(); hit " + hits.fn); michael@0: ok(numGlobalNonevals == 1, "(gn) Overall script, hit " + hits.gn); michael@0: ok(numGlobalEvals == 1, "(ge) Eval in global area, hit " + hits.ge); michael@0: ok(numFunctionEvals == 2, "(fe) Evals within f1() and f2(), hit " + hits.fe); michael@0: michael@0: if (!jsdOnAtStart) { michael@0: // turn JSD off if it wasn't on when this test started michael@0: jsd.off(); michael@0: ok(!jsd.isOn, "JSD shouldn't be running at the end of this test."); michael@0: } michael@0: michael@0: SimpleTest.finish(); michael@0: } michael@0: michael@0: testJSD(jsd);