1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/gc-08.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,22 @@ 1.4 +// Debuggers with enabled onExceptionUnwind hooks should not be GC'd even if 1.5 +// they are otherwise unreachable. 1.6 + 1.7 +load(libdir + "asserts.js"); 1.8 + 1.9 +var g = newGlobal(); 1.10 +var actual = 0; 1.11 +var expected = 0; 1.12 + 1.13 +function f() { 1.14 + for (var i = 0; i < 20; i++) { 1.15 + var dbg = new Debugger(g); 1.16 + dbg.num = i; 1.17 + dbg.onExceptionUnwind = function (stack, exc) { actual += this.num; }; 1.18 + expected += i; 1.19 + } 1.20 +} 1.21 + 1.22 +f(); 1.23 +gc(); 1.24 +assertThrowsValue(function () { g.eval("throw 'fit';"); }, "fit"); 1.25 +assertEq(actual, expected);