diff options
Diffstat (limited to 'js/src/jit-test/tests/debug/Frame-older-generators-04.js')
-rw-r--r-- | js/src/jit-test/tests/debug/Frame-older-generators-04.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Frame-older-generators-04.js b/js/src/jit-test/tests/debug/Frame-older-generators-04.js new file mode 100644 index 0000000000..405e08bed5 --- /dev/null +++ b/js/src/jit-test/tests/debug/Frame-older-generators-04.js @@ -0,0 +1,28 @@ +// Test that Debugger.Frame.prototype.older works on suspended async functions. + +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 promise = g.f(); + + assertEq(frame.older, null); + + await promise; + + assertThrowsInstanceOf(() => frame.older, Error); +})(); |