Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // Basic enterFrame hook tests.
3 var g = newGlobal();
4 var dbg = Debugger(g);
5 var type;
6 dbg.onEnterFrame = function (frame) {
7 try {
8 assertEq(frame instanceof Debugger.Frame, true);
9 assertEq(frame.live, true);
10 type = frame.type;
11 } catch (exc) {
12 type = "Exception thrown: " + exc;
13 }
14 };
16 function test(f, expected) {
17 type = undefined;
18 f();
19 assertEq(type, expected);
20 }
22 // eval triggers the hook
23 test(function () { g.eval("function h() { return 1; }"); }, "eval");
25 // function calls trigger it
26 test(function () { assertEq(g.h(), 1); }, "call");
28 // global scripts trigger it
29 test(function () { g.evaluate("var x = 5;"); assertEq(g.x, 5); }, "global");