1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/onEnterFrame-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +// Basic enterFrame hook tests. 1.5 + 1.6 +var g = newGlobal(); 1.7 +var dbg = Debugger(g); 1.8 +var type; 1.9 +dbg.onEnterFrame = function (frame) { 1.10 + try { 1.11 + assertEq(frame instanceof Debugger.Frame, true); 1.12 + assertEq(frame.live, true); 1.13 + type = frame.type; 1.14 + } catch (exc) { 1.15 + type = "Exception thrown: " + exc; 1.16 + } 1.17 +}; 1.18 + 1.19 +function test(f, expected) { 1.20 + type = undefined; 1.21 + f(); 1.22 + assertEq(type, expected); 1.23 +} 1.24 + 1.25 +// eval triggers the hook 1.26 +test(function () { g.eval("function h() { return 1; }"); }, "eval"); 1.27 + 1.28 +// function calls trigger it 1.29 +test(function () { assertEq(g.h(), 1); }, "call"); 1.30 + 1.31 +// global scripts trigger it 1.32 +test(function () { g.evaluate("var x = 5;"); assertEq(g.x, 5); }, "global");