summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/onEnterFrame-generator-05.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/onEnterFrame-generator-05.js')
-rw-r--r--js/src/jit-test/tests/debug/onEnterFrame-generator-05.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/onEnterFrame-generator-05.js b/js/src/jit-test/tests/debug/onEnterFrame-generator-05.js
new file mode 100644
index 0000000000..cacb1b825b
--- /dev/null
+++ b/js/src/jit-test/tests/debug/onEnterFrame-generator-05.js
@@ -0,0 +1,34 @@
+// When resuming a generator triggers one Debugger's onEnterFrame handler,
+// all Debuggers' Debugger.Frames become usable at once.
+
+load(libdir + "asserts.js");
+
+let g = newGlobal({newCompartment: true});
+g.eval(`
+ function* f() {
+ yield 1;
+ }
+`);
+let dbg1 = new Debugger(g);
+let dbg2 = new Debugger(g);
+
+let hits = 0;
+let savedFrame1;
+let savedFrame2;
+dbg1.onEnterFrame = frame => {
+ if (savedFrame1 === undefined) {
+ savedFrame1 = frame;
+ savedFrame2 = dbg2.getNewestFrame();
+ } else {
+ hits++;
+ assertEq(savedFrame1, frame);
+ for (let f of [savedFrame2, savedFrame1]) {
+ assertEq(f.type, "call");
+ assertEq(f.callee.name, "f");
+ }
+ }
+};
+
+let values = [...g.f()];
+assertEq(hits, 2);
+assertDeepEq(values, [1]);