Frame-callee-01.js (617B)
1 // Frame.prototype.callee for a normal function frame. 2 3 load(libdir + "asserts.js"); 4 5 var g = newGlobal({ newCompartment: true }); 6 var dbg = new Debugger(g); 7 g.eval(` 8 function f() {} 9 `); 10 11 const fObj = dbg.makeGlobalObjectReference(g).makeDebuggeeValue(g.f); 12 let frame; 13 let callee; 14 dbg.onEnterFrame = function(f) { 15 frame = f; 16 callee = frame.callee; 17 }; 18 19 g.f(); 20 21 assertEq(frame instanceof Debugger.Frame, true); 22 assertEq(callee instanceof Debugger.Object, true); 23 assertEq(callee, fObj); 24 25 // The frame has finished evaluating, so the callee is no longer accessible. 26 assertThrowsInstanceOf(() => frame.callee, Error);