Frame-constructing-01.js (501B)
1 // Debugger.Frame.prototype.constructing on a generator. 2 3 load(libdir + "asserts.js"); 4 5 const g = newGlobal({ newCompartment: true }); 6 const dbg = Debugger(g); 7 8 g.eval(` 9 function* f() {} 10 `); 11 12 let frame; 13 dbg.onEnterFrame = function(f) { 14 frame = f; 15 assertEq(frame.constructing, false); 16 }; 17 18 const it = g.f(); 19 20 assertEq(frame.constructing, false); 21 frame = null; 22 23 it.next(); 24 25 assertEq(!!frame, true); 26 // Throws because the frame has terminated. 27 assertThrowsInstanceOf(() => frame.constructing, Error);