bug-1385844-2.js (1288B)
1 // Frame invalidatation should not follow 'debugger eval prev' links. 2 // This should not fail a 'frame.isDebuggee()' assertion. 3 // This version of the test requires only a single Debugger, and a single 4 // debuggee global. 5 6 var g = newGlobal({ newCompartment: true }); 7 var dbg = new Debugger(g); 8 9 g.eval(` 10 function f() { debugger; } 11 `); 12 g.observeAll = observeAll; 13 14 dbg.onDebuggerStatement = first; 15 g.eval(`debugger;`); 16 17 var saved; 18 function first(frame) { 19 saved = frame; 20 dbg.onDebuggerStatement = second; 21 saved.eval(`f()`); 22 } 23 24 function second() { 25 saved.eval(`observeAll()`); 26 } 27 28 function observeAll() { 29 // Setting this hook causes `Debugger::updateExecutionObservabilityOfFrames` 30 // to walk the stack looking for frames running in `g` and marking them as 31 // debuggees. It should ignore 'debugger eval prev' links; if it does not, the 32 // traversal will jump from the frame for `second`'s eval directly to `saved`, 33 // the frame for the `g.eval` call. In particular, it will not visit the frame 34 // for the eval in `first`, which was never marked as a debuggee. (Simply 35 // being created for a `Debugger.Frame.prototype.eval` call doesn't 36 // necessarily mark you as a debuggee, if your behavior doesn't need to be 37 // observed.) 38 dbg.onEnterFrame = function () { }; 39 }