bug-1444604-reduced.js (936B)
1 // LiveSavedFrameCache should not be confused by eval-in-frame-prev links. 2 3 const g = newGlobal({newCompartment: true}); 4 const dbg = new Debugger(); 5 const gDO = dbg.addDebuggee(g); 6 7 g.evaluate(` 8 function inner() { debugger; } 9 function outer() { inner(); } 10 `); 11 12 dbg.onDebuggerStatement = function handler(frame) { 13 // Capture the JS stack, putting frames for handler, inner, and outer in the 14 // cache. Perform all captures in g's compartment, to avoid flushing the cache 15 // for compartment mismatches. 16 frame.eval('print(`in inner: ${saveStack()}`)'); 17 18 // Carry out a capture in outer's context, following the eval-in-frame prev 19 // link and thus skipping over inner, removing it from the cache. 20 frame.older.eval('print(`in outer: ${saveStack()}`)'); 21 22 // Capture again. inner's hasCachedSavedFrame bit should be set, but its entry 23 // has been flushed. 24 frame.eval('print(`in inner: ${saveStack()}`)'); 25 }; 26 27 g.outer();