onExceptionUnwind-resumption-05.js (635B)
1 // Make sure that stacks in completion values are not lost when an exception 2 // unwind hook returns undefined. 3 4 let g = newGlobal({ newCompartment: true }); 5 g.eval(` 6 function foo() { 7 bar(); 8 } 9 function bar() { 10 throw new Error(); 11 } 12 `); 13 14 let dbg = Debugger(g); 15 let unwindHits = 0, popHits = 0; 16 dbg.onExceptionUnwind = frame => { 17 unwindHits++; 18 return undefined; 19 } 20 dbg.onEnterFrame = frame => { 21 frame.onPop = completion => { 22 assertEq(completion.stack.functionDisplayName, "bar"); 23 popHits++; 24 }; 25 }; 26 27 try { 28 g.eval("foo()"); 29 } catch (e) {} 30 assertEq(unwindHits, 3); 31 assertEq(popHits, 3); 32 dbg.removeDebuggee(g);