summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-find-01.js
blob: abce77df16f7b82af600710392e759f7465858f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// find sees that vars are hoisted out of with statements.

var g = newGlobal({newCompartment: true});
var dbg = Debugger(g);
var hits = 0;
dbg.onDebuggerStatement = function (frame) {
    assertEq(frame.environment.find("x").type, "with");
    hits++;
};

assertEq(g.eval("(function () {\n" +
                "    function g() { x = 1; }\n" +
                "    with ({x: 2}) {\n" +
                "        var x;\n" +
                "        debugger;\n" +
                "        return x;\n" +
                "    }\n" +
                "})();"), 2);
assertEq(hits, 1);