fb02c04d48
Similar to the `AsyncFunctionReject` builtin, the `AsyncGeneratorReject` should also mark the promise rejection as a non-debuggable event. That is because the initial throw that causes the generator rejection downstream alreay triggered the debuggable event. We can re-use one of the existing tests as a regression test here: If we wait for the Runtime.evaluate promise to resolve after the first pause, we ensure that we already paused once. The test in its current form swallowed the second pause implicitly by disabling the debugger. R=bmeurer@chromium.org Bug: chromium:1270780 Change-Id: I97ab08934804fefd097e9bd01081469da5379154 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4084925 Commit-Queue: Simon Zünd <szuend@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/main@{#84756}
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
// Copyright 2022 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start('Regression test for crbug.com/1220203.');
|
|
|
|
contextGroup.addScript(`
|
|
async function *generatorFunction() {
|
|
await 1;
|
|
throwError();
|
|
}
|
|
|
|
function throwError() {
|
|
throw new Error();
|
|
}
|
|
|
|
async function main() {
|
|
for await (const value of generatorFunction()) {}
|
|
}`);
|
|
|
|
session.setupScriptMap();
|
|
|
|
InspectorTest.runAsyncTestSuite([
|
|
async function testBreakOnUncaughtException() {
|
|
await Promise.all([
|
|
Protocol.Runtime.enable(),
|
|
Protocol.Debugger.enable(),
|
|
Protocol.Debugger.setPauseOnExceptions({state: 'uncaught'}),
|
|
]);
|
|
const pausedPromise = Protocol.Debugger.oncePaused();
|
|
const evalPromise = Protocol.Runtime.evaluate({expression: 'main()', awaitPromise: true});
|
|
const {params: {callFrames, data}} = await pausedPromise;
|
|
InspectorTest.log(`${data.uncaught ? 'Uncaught' : 'Caught'} exception at`);
|
|
await session.logSourceLocation(callFrames[0].location);
|
|
|
|
await Protocol.Debugger.resume();
|
|
// Wait on this before the Promise.all to ensure we didn't break twice (crbug.com/1270780).
|
|
await evalPromise;
|
|
|
|
await Promise.all([
|
|
Protocol.Runtime.disable(),
|
|
Protocol.Debugger.disable(),
|
|
]);
|
|
},
|
|
]);
|