js/src/jit-test/tests/debug/Frame-live-02.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 false for frames that have thrown or been thrown through
michael@0 3
michael@0 4 load(libdir + "asserts.js");
michael@0 5
michael@0 6 var g = newGlobal();
michael@0 7 g.debuggeeGlobal = this;
michael@0 8 g.eval("var finalCheck;");
michael@0 9 g.eval("(" + function () {
michael@0 10 var a = [];
michael@0 11 var dbg = Debugger(debuggeeGlobal);
michael@0 12 dbg.onDebuggerStatement = function (frame) {
michael@0 13 a.push(frame);
michael@0 14 for (var i = 0; i < a.length; i++)
michael@0 15 assertEq(a[i].live, true);
michael@0 16 };
michael@0 17 finalCheck = function (n) {
michael@0 18 assertEq(a.length, n);
michael@0 19 for (var i = 0; i < n; i++)
michael@0 20 assertEq(a[i].live, false);
michael@0 21 };
michael@0 22 } + ")()");
michael@0 23
michael@0 24 function f(n) {
michael@0 25 debugger;
michael@0 26 if (--n > 0)
michael@0 27 f(n);
michael@0 28 else
michael@0 29 throw "fit";
michael@0 30 }
michael@0 31
michael@0 32 assertThrowsValue(function () { f(10); }, "fit");
michael@0 33 g.finalCheck(10);

mercurial