v8/test/inspector/debugger/step-out-async-await.js
Benedikt Meurer 3740764cca [debug][cleanup] Use consistent StepInto and StepOver naming.
In the Chrome DevTools Protocol, the step actions are named StepOut,
StepOver, and StepInto, but internally we used StepOut, StepNext, and
StepIn instead. This change adjusts the naming to be consistent.

Bug: chromium:901814, chromium:1162229
Change-Id: Id3502a1b0a4aadd94734ec3d1fef73c1782fa220
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2928510
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74877}
2021-06-01 11:26:57 +00:00

73 lines
2.6 KiB
JavaScript

// Copyright 2017 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.
// TODO(kozyatinskiy): on StepOut and probably StepOver at return position
// of async generator we should break at next instruction of resumed generator
// instead of next scheduled microtask.
let {session, contextGroup, Protocol} = InspectorTest.start('StepOut from return position of async function.');
contextGroup.addScript(`
async function testFunction() {
async function foo() {
var p = Promise.resolve();
await p;
p.then(() => 1);
debugger;
return p;
}
await foo();
}
`);
session.setupScriptMap();
Protocol.Debugger.enable();
InspectorTest.runAsyncTestSuite([
async function testStepInto() {
Protocol.Runtime.evaluate({expression: 'testFunction()'});
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.resume();
},
async function testStepOver() {
Protocol.Runtime.evaluate({expression: 'testFunction()'});
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOver();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOver();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOver();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.resume();
},
async function testStepOut() {
Protocol.Runtime.evaluate({expression: 'testFunction()'});
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOut();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOut();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.resume();
},
]);
function logPauseLocation(message) {
return session.logSourceLocation(message.params.callFrames[0].location);
}