summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-setVariable-19.js
blob: ed6f14236440ec3f935cd99b4b7dbfe5769bcf66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Access on non-syntactic lexical environment's binding.

var g = newGlobal();
g.evaluate(`
(function () {
    const otherDebugger = newGlobal({ sameZoneAs: this }).Debugger;
    const dbg = otherDebugger(this);

    const env = dbg.getNewestFrame().callee.environment;
    var ran = false;
    try {
        env.setVariable("tdz_variable", 10);
        ran = true;
    } catch (e) { }
    assertEq(ran, false);
})();

// We shouldn't crash when initializing this.
let tdz_variable = 10;
`, {
  envChainObject: {},
});