a3b145c714
Properly push back the current request promise for async generators when resuming after an `await` to ensure that the catch prediction works as expected for async generators. Fixed: chromium:1220203 Change-Id: I8c3592ceb567aadcba8f460794cd5d60a965a360 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3442680 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Auto-Submit: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Philip Pfaffe <pfaffe@chromium.org> Commit-Queue: Philip Pfaffe <pfaffe@chromium.org> Cr-Commit-Position: refs/heads/main@{#78984}
43 lines
1.3 KiB
JavaScript
43 lines
1.3 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 Promise.all([
|
|
Protocol.Debugger.resume(),
|
|
evalPromise,
|
|
Protocol.Runtime.disable(),
|
|
Protocol.Debugger.disable(),
|
|
]);
|
|
},
|
|
]);
|