summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-setVariable-18.js
blob: 85339d96a9f7765a2e61145e636a7bebe67c08aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function f() {
    (function () {
        const otherDebugger = newGlobal({ sameZoneAs: this }).Debugger;
        const dbg = otherDebugger(this);

        const env = dbg.getNewestFrame().callee.environment;
        var ran = false;
        try {
            // this should throw, as tdz_variable is still in the tdz at
            // this point.
            env.setVariable("tdz_variable", 10);
            ran = true;
        } catch (e) { }
        assertEq(ran, false);
    })();

    function bar() {
        return tdz_variable;
    }


    let tdz_variable = 10;
}
f();