js/src/jit-test/tests/debug/Frame-live-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 // |jit-test| debug
michael@0 2 // Debugger.Frame.prototype.live is true for frames on the stack and false for
michael@0 3 // frames that have returned
michael@0 4
michael@0 5 var desc = Object.getOwnPropertyDescriptor(Debugger.Frame.prototype, "live");
michael@0 6 assertEq(typeof desc.get, "function");
michael@0 7 assertEq(desc.set, undefined);
michael@0 8 assertEq(desc.configurable, true);
michael@0 9 assertEq(desc.enumerable, false);
michael@0 10
michael@0 11 var loc;
michael@0 12
michael@0 13 var g = newGlobal();
michael@0 14 g.debuggeeGlobal = this;
michael@0 15 g.eval("var hits = 0;");
michael@0 16 g.eval("(" + function () {
michael@0 17 var a = [];
michael@0 18 var dbg = Debugger(debuggeeGlobal);
michael@0 19 dbg.onDebuggerStatement = function (frame) {
michael@0 20 var loc = debuggeeGlobal.loc;
michael@0 21 a[loc] = frame;
michael@0 22 for (var i = 0; i < a.length; i++) {
michael@0 23 assertEq(a[i] === frame, i === loc);
michael@0 24 assertEq(!!(a[i] && a[i].live), i >= loc);
michael@0 25 }
michael@0 26 hits++;
michael@0 27 };
michael@0 28 } + ")()");
michael@0 29
michael@0 30 function f(n) {
michael@0 31 loc = n; debugger;
michael@0 32 if (n !== 0) {
michael@0 33 f(n - 1);
michael@0 34 loc = n; debugger;
michael@0 35 eval("f(n - 1);");
michael@0 36 loc = n; debugger;
michael@0 37 }
michael@0 38 }
michael@0 39
michael@0 40 f(4);
michael@0 41 assertEq(g.hits, 16 + 8*3 + 4*3 + 2*3 + 1*3);
michael@0 42

mercurial