summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onPop-async-generators-01.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Frame-onPop-async-generators-01.js')
-rw-r--r--js/src/jit-test/tests/debug/Frame-onPop-async-generators-01.js53
1 files changed, 53 insertions, 0 deletions
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";
+});
+