Fix bug in Debug::hasAnyLiveHooks.

This commit is contained in:
Jason Orendorff 2011-06-02 21:32:22 -05:00
parent 19c1ad7ee1
commit 2ed818c0ac
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,22 @@
// |jit-test| debug
// Debuggers with enabled throw hooks should not be GC'd even if they are
// otherwise unreachable.
load(libdir + "asserts.js");
var g = newGlobal('new-compartment');
var actual = 0;
var expected = 0;
function f() {
for (var i = 0; i < 20; i++) {
var dbg = new Debug(g);
dbg.hooks = {num: i, throw: function (stack, exc) { actual += this.num; }};
expected += i;
}
}
f();
gc();
assertThrowsValue(function () { g.eval("throw 'fit';"); }, "fit");
assertEq(actual, expected);

View File

@ -214,7 +214,7 @@ class Debug {
bool bool
Debug::hasAnyLiveHooks() const Debug::hasAnyLiveHooks() const
{ {
return observesDebuggerStatement(); return enabled && (hasDebuggerHandler || hasThrowHandler);
} }
bool bool