Commit 3928133c authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[inspector] async function call is not candidate for stepping

We should not report promise created for async function as candidate
for stepping. Regular StepInto works fine in this case.

TBR=dgozman@chromium.org

Bug: none
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I8dafec5417df0de593cb2a1c06d6a11093e7c64b
Reviewed-on: https://chromium-review.googlesource.com/828024Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50176}
parent bd3efe28
......@@ -538,7 +538,6 @@ void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type,
switch (type) {
case v8::debug::kDebugAsyncFunctionPromiseCreated:
asyncTaskScheduledForStack("async function", task, true);
if (!isBlackboxed) asyncTaskCandidateForStepping(task, true);
break;
case v8::debug::kDebugPromiseThen:
asyncTaskScheduledForStack("Promise.then", task, false);
......
......@@ -206,3 +206,81 @@ paused at:
createPromise().then(#v => v * 2);
}
Running test: testWithBlackboxedCode
paused at:
function testBlackboxedCreatePromise() {
#debugger;
createPromise().then(v => v * 2);
paused at:
debugger;
#createPromise().then(v => v * 2);
}
paused at:
debugger;
createPromise().#then(v => v * 2);
}
asyncCallStackTraceId is set
paused at:
debugger;
createPromise().then(#v => v * 2);
}
Running test: testAsyncFunction
paused at:
async function testAsyncFunction() {
#debugger;
foo();
paused at:
debugger;
#foo();
await foo();
paused at:
async function foo() {
#return 42;
}
paused at:
foo();
await #foo();
foo().then(boo);
paused at:
async function foo() {
#return 42;
}
paused at:
await foo();
#foo().then(boo);
paused at:
async function foo() {
#return 42;
}
paused at:
await foo();
foo().#then(boo);
paused at:
await foo();
foo().#then(boo);
asyncCallStackTraceId is set
paused at:
function boo#() {
}
......@@ -45,6 +45,20 @@ function testBlackboxedCreatePromise() {
debugger;
createPromise().then(v => v * 2);
}
async function testAsyncFunction() {
debugger;
foo();
await foo();
foo().then(boo);
async function foo() {
return 42;
}
function boo() {
}
}
//# sourceURL=test.js`);
contextGroup.addScript(`
......@@ -167,6 +181,52 @@ InspectorTest.runAsyncTestSuite([
Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId});
Protocol.Debugger.resume();
await waitPauseAndDumpLocation();
await Protocol.Debugger.resume();
},
async function testWithBlackboxedCode() {
Protocol.Runtime.evaluate({expression: 'testBlackboxedCreatePromise()'});
await waitPauseAndDumpLocation();
Protocol.Debugger.stepOver();
await waitPauseAndDumpLocation();
await Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']});
Protocol.Debugger.stepInto({breakOnAsyncCall: true});
let parentStackTraceId = await waitPauseAndDumpLocation();
Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId});
Protocol.Debugger.resume();
await waitPauseAndDumpLocation();
await Protocol.Debugger.resume();
},
async function testAsyncFunction() {
Protocol.Runtime.evaluate({expression: 'testAsyncFunction()'});
await waitPauseAndDumpLocation();
Protocol.Debugger.stepOver();
await waitPauseAndDumpLocation();
Protocol.Debugger.stepInto({breakOnAsyncCall: true});
let parentStackTraceId = await waitPauseAndDumpLocation();
if (parentStackTraceId)
InspectorTest.log(
'ERROR: we should not report parent stack trace id on async call');
Protocol.Debugger.stepOut();
await waitPauseAndDumpLocation();
Protocol.Debugger.stepInto({breakOnAsyncCall: true});
parentStackTraceId = await waitPauseAndDumpLocation();
if (parentStackTraceId)
InspectorTest.log(
'ERROR: we should not report parent stack trace id on async call');
Protocol.Debugger.stepOut();
await waitPauseAndDumpLocation();
Protocol.Debugger.stepInto({breakOnAsyncCall: true});
await waitPauseAndDumpLocation();
Protocol.Debugger.stepOut();
await waitPauseAndDumpLocation();
Protocol.Debugger.stepInto({breakOnAsyncCall: true});
parentStackTraceId = await waitPauseAndDumpLocation();
Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId});
Protocol.Debugger.resume();
await waitPauseAndDumpLocation();
await Protocol.Debugger.resume();
}
]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment