js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // If debugger.onEnterFrame returns {return:val}, the frame returns.
michael@0 2
michael@0 3 var g = newGlobal();
michael@0 4 g.set = false;
michael@0 5 g.eval("function f() {\n" +
michael@0 6 " set = true;\n" +
michael@0 7 " return 'fail';\n" +
michael@0 8 "}\n");
michael@0 9 g.eval("function g() { return 'g ' + f(); }");
michael@0 10 g.eval("function h() { return 'h ' + g(); }");
michael@0 11
michael@0 12 var dbg = Debugger(g);
michael@0 13 var savedFrame;
michael@0 14 dbg.onEnterFrame = function (frame) {
michael@0 15 savedFrame = frame;
michael@0 16 return {return: "pass"};
michael@0 17 };
michael@0 18
michael@0 19 // Call g.f as a function.
michael@0 20 savedFrame = undefined;
michael@0 21 assertEq(g.f(), "pass");
michael@0 22 assertEq(savedFrame.live, false);
michael@0 23 assertEq(g.set, false);
michael@0 24
michael@0 25 // Call g.f as a constructor.
michael@0 26 savedFrame = undefined;
michael@0 27 var r = new g.f;
michael@0 28 assertEq(typeof r, "object");
michael@0 29 assertEq(savedFrame.live, false);
michael@0 30 assertEq(g.set, false);
michael@0 31
michael@0 32 var count = 0;
michael@0 33 dbg.onEnterFrame = function (frame) {
michael@0 34 count++;
michael@0 35 if (count == 3) {
michael@0 36 savedFrame = frame;
michael@0 37 return {return: "pass"};
michael@0 38 }
michael@0 39 return undefined;
michael@0 40 };
michael@0 41 g.set = false;
michael@0 42 savedFrame = undefined;
michael@0 43 assertEq(g.h(), "h g pass");
michael@0 44 assertEq(savedFrame.live, false);
michael@0 45 assertEq(g.set, false);

mercurial