summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-gc-01.js
blob: 1fbd8b9efb6bb91660db5337c115326edff81baa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// An Environment keeps its referent alive.

var g = newGlobal();
g.eval("function f(x) { return 2 * x; }");
var dbg = Debugger(g);
var env;
dbg.onEnterFrame = function (frame) { env = frame.environment; };
assertEq(g.f(22), 44);
dbg.onEnterFrame = undefined;

assertEq(env.find("x"), env);
assertEq(env.names().join(","), "arguments,x");

gc();
g.gc(g);
gc(env);

assertEq(env.find("x"), env);
assertEq(env.names().join(","), "arguments,x");