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 --- .../debug/onExceptionUnwind-resumption-async-02.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 js/src/jit-test/tests/debug/onExceptionUnwind-resumption-async-02.js (limited to 'js/src/jit-test/tests/debug/onExceptionUnwind-resumption-async-02.js') diff --git a/js/src/jit-test/tests/debug/onExceptionUnwind-resumption-async-02.js b/js/src/jit-test/tests/debug/onExceptionUnwind-resumption-async-02.js new file mode 100644 index 0000000000..00a05d545a --- /dev/null +++ b/js/src/jit-test/tests/debug/onExceptionUnwind-resumption-async-02.js @@ -0,0 +1,31 @@ +// |jit-test| error:all-jobs-completed-successfully +// Verifiy that onExceptionUnwind's force-return queues the promise +// microtask to run in the debuggee's job queue, not the debugger's +// AutoDebuggerJobQueueInterruption. + +let g = newGlobal({ newCompartment: true }); +g.eval(` + async function asyncFn(x) { + await Promise.resolve(); + throw new Error(); + } + function enterDebuggee(){} +`); +const dbg = new Debugger(g); + +(async function() { + let it = g.asyncFn(); + + // Force-return when the exception throws after await resume. + dbg.onExceptionUnwind = () => { + return { return: "exit" }; + }; + + const result = await it; + assertEq(result, "exit"); + // If execution here is resumed from the debugger's queue, this call will + // trigger DebuggeeWouldRun exception. + g.enterDebuggee(); + + throw "all-jobs-completed-successfully"; +})(); -- cgit v1.2.3