Debian Codegraph @

js/src/jit-test/tests/debug/Frame-eval-26.js

raw
1 // Bug 1026477: Defining functions with D.F.p.eval works, even if there's
2 // already a non-aliased var binding for the identifier.
3
4 var g = newGlobal({newCompartment: true});
5 var dbg = new Debugger(g);
6 dbg.onDebuggerStatement = function (frame) {
7 frame.older.eval('function f() { }');
8 };
9
10 // When the compiler sees the 'debugger' statement, it marks all variables as
11 // aliased, but we want to test the case where f is in a stack frame slot, so we
12 // put the 'debugger' statement in a separate function, and use frame.older to
13 // get back to the anonymous function's frame.
14 g.eval('function q() { debugger; }');
15 assertEq(typeof g.eval('(function () { var f = 42; q(); return f; })();'),
16 "function");