2017-03-28 21:14:19 +00:00
|
|
|
// 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 StepNext at return position
|
|
|
|
// of async generator we should break at next instruction of resumed generator
|
|
|
|
// instead of next scheduled microtask.
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start('StepOut from return position of async function.');
|
2017-03-28 21:14:19 +00:00
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
contextGroup.addScript(`
|
2017-03-28 21:14:19 +00:00
|
|
|
async function testFunction() {
|
|
|
|
async function foo() {
|
|
|
|
var p = Promise.resolve();
|
|
|
|
await p;
|
|
|
|
p.then(() => 1);
|
|
|
|
debugger;
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
await foo();
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
session.setupScriptMap();
|
2017-03-28 21:14:19 +00:00
|
|
|
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) {
|
2017-05-19 00:35:45 +00:00
|
|
|
return session.logSourceLocation(message.params.callFrames[0].location);
|
2017-03-28 21:14:19 +00:00
|
|
|
}
|