From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../tests/debug/Frame-onPop-async-generators-01.js | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 js/src/jit-test/tests/debug/Frame-onPop-async-generators-01.js (limited to 'js/src/jit-test/tests/debug/Frame-onPop-async-generators-01.js') diff --git a/js/src/jit-test/tests/debug/Frame-onPop-async-generators-01.js b/js/src/jit-test/tests/debug/Frame-onPop-async-generators-01.js new file mode 100644 index 0000000000..0c2cc27f8c --- /dev/null +++ b/js/src/jit-test/tests/debug/Frame-onPop-async-generators-01.js @@ -0,0 +1,53 @@ +// |jit-test| error:all-jobs-completed-successfully + +load(libdir + "asserts.js"); +load(libdir + 'match.js'); +load(libdir + 'match-debugger.js'); +const { Pattern } = Match; +const { OBJECT_WITH_EXACTLY: EXACT } = Pattern; + +let g = newGlobal({newCompartment: true}); +let dbg = Debugger(g); +const log = []; +g.capture = function () { + dbg.getNewestFrame().onPop = completion => { + log.push(completion); + }; +}; + +g.eval(` + async function* asyncgen() { + capture(); + await Promise.resolve(1); + yield 2; + await Promise.resolve(3); + yield 4; + return "ok"; + } +`); + +async function collect() { + let items = []; + for await (let item of g.asyncgen()) { + items.push(item); + } + return items; +} + +collect().then(value => { + assertDeepEq(value, [2, 4]); + + Pattern([ + EXACT({ return: new DebuggerObjectPattern("Promise"), await: true }), + EXACT({ return: 2, await: true }), + EXACT({ return: 2, yield: true }), + EXACT({ return: new DebuggerObjectPattern("Promise"), await: true }), + EXACT({ return: 4, await: true }), + EXACT({ return: 4, yield: true }), + EXACT({ return: "ok", await: true }), + EXACT({ return: "ok" }), + ]).assert(log); + + throw "all-jobs-completed-successfully"; +}); + -- cgit v1.2.3