diff options
Diffstat (limited to 'js/src/jit-test/tests/debug/Frame-older-generators-05.js')
-rw-r--r-- | js/src/jit-test/tests/debug/Frame-older-generators-05.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Frame-older-generators-05.js b/js/src/jit-test/tests/debug/Frame-older-generators-05.js new file mode 100644 index 0000000000..61267a8443 --- /dev/null +++ b/js/src/jit-test/tests/debug/Frame-older-generators-05.js @@ -0,0 +1,32 @@ +// Test that Debugger.Frame.prototype.older works on suspended async generators. + +load(libdir + "asserts.js"); + +const g = newGlobal({ newCompartment: true }); +const dbg = new Debugger(g); + +g.eval(` +async function* f() { + await Promise.resolve(); +} +`); + +let frame; +dbg.onEnterFrame = f => { + frame = f; + dbg.onEnterFrame = undefined; +}; + +(async () => { + const it = g.f(); + + assertEq(frame.older, null); + + const promise = it.next(); + + assertEq(frame.older, null); + + await promise; + + assertThrowsInstanceOf(() => frame.older, Error); +})(); |