onEnterFrame-async-tryskipawait-03.js (1000B)
1 // CanSkipAwait with plain objects when attaching onEnterFrame 2 // after the initial call into the async function. 3 4 load(libdir + "array-compare.js"); 5 6 let g = newGlobal({ newCompartment: true }); 7 let dbg = new Debugger(g); 8 9 let log = []; 10 g.log = log; 11 12 g.eval(` 13 async function f() { 14 log.push("START"); 15 await {}; 16 log.push("MIDDLE"); 17 await {}; 18 log.push("END"); 19 } 20 `); 21 22 function neverCalled(e) { 23 // Quit with non-zero exit code to ensure a test suite error is shown, 24 // even when this function is called within promise handlers which normally 25 // swallow any exceptions. 26 print("Error: " + e + "\nstack:\n" + e.stack); 27 quit(1); 28 } 29 30 g.f().then(() => { 31 assertEq(arraysEqual(log, [ 32 "START", 33 "enter: f", 34 "MIDDLE", 35 "enter: f", // Await not optimised away in JSOP_TRYSKIPAWAIT! 36 "END", 37 ]), true); 38 }).catch(neverCalled); 39 40 dbg.onEnterFrame = frame => { 41 log.push(`enter: ${frame.callee.name}`); 42 };