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