blob: ec6804cacbb6bbf73f2ece8a5b5fd86ab72743ab (
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({newCompartment: true});
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");
|