PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/debug/onEnterFrame-03.js

http://github.com/zpao/v8monkey
JavaScript | 23 lines | 18 code | 3 blank | 2 comment | 1 complexity | 23056aa43d1f7f83891d1f69bd1bbdc6 MD5 | raw file
 1// frame.eval works in the enterFrame hook.
 2// It triggers the enterFrame hook again, recursively. (!)
 3
 4var g = newGlobal('new-compartment');
 5g.a = ".";
 6
 7var dbg = Debugger(g);
 8var nestCount = 0, N = 9;
 9var log = "";
10dbg.onEnterFrame = function (frame) {
11    assertEq(frame.type, "eval");
12    if (nestCount < N) {
13        log += '(';
14        nestCount++;
15        var a = frame.eval("a").return;
16        log += a;
17        nestCount--;
18        log += ')';
19    }
20};
21
22assertEq(g.eval("a"), ".");
23assertEq(log, Array(N + 1).join("(") + Array(N + 1).join(".)"));