Commit b2b7e8de authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

inspector: do not report async tail in Debugger.scriptParsed event

Async tail might be long. On frontend side we use only top frame so
we can report tail using id.

R=dgozman@chromium.org

Bug: chromium:873865
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ie9e6b5c4c000cc6bedce2d5fec9f3fa22ea21768
Reviewed-on: https://chromium-review.googlesource.com/c/1286959
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56784}
parent 236b8e9c
......@@ -1418,8 +1418,9 @@ void V8DebuggerAgentImpl::didParseSource(
std::unique_ptr<V8StackTraceImpl> stack =
V8StackTraceImpl::capture(m_inspector->debugger(), contextGroupId, 1);
std::unique_ptr<protocol::Runtime::StackTrace> stackTrace =
stack && !stack->isEmpty() ? stack->buildInspectorObjectImpl(m_debugger)
: nullptr;
stack && !stack->isEmpty()
? stack->buildInspectorObjectImpl(m_debugger, 0)
: nullptr;
if (success) {
// TODO(herhut, dgozman): Report correct length for WASM if needed for
// coverage. Or do not send the length at all and change coverage instead.
......
......@@ -268,9 +268,15 @@ StringView V8StackTraceImpl::topFunctionName() const {
std::unique_ptr<protocol::Runtime::StackTrace>
V8StackTraceImpl::buildInspectorObjectImpl(V8Debugger* debugger) const {
return buildInspectorObjectImpl(debugger, m_maxAsyncDepth);
}
std::unique_ptr<protocol::Runtime::StackTrace>
V8StackTraceImpl::buildInspectorObjectImpl(V8Debugger* debugger,
int maxAsyncDepth) const {
return buildInspectorObjectCommon(debugger, m_frames, String16(),
m_asyncParent.lock(), m_externalParent,
m_maxAsyncDepth);
maxAsyncDepth);
}
std::unique_ptr<protocol::Runtime::API::StackTrace>
......
......@@ -63,6 +63,9 @@ class V8StackTraceImpl : public V8StackTrace {
std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl(
V8Debugger* debugger) const;
std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl(
V8Debugger* debugger, int maxAsyncDepth) const;
// V8StackTrace implementation.
// This method drops the async stack trace.
std::unique_ptr<V8StackTrace> clone() override;
......
Debugger.scriptParsed.stackTrace should contain only one frame
{
method : Debugger.scriptParsed
params : {
endColumn : 0
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 3fb75160ab1f4e4e82675bc4cd924d3481abe278
isLiveEdit : false
isModule : false
length : 0
scriptId : <scriptId>
sourceMapURL :
stackTrace : {
callFrames : [
[0] : {
columnNumber : 17
functionName : setTimeout
lineNumber : 0
scriptId : <scriptId>
url :
}
]
parentId : {
id : <id>
}
}
startColumn : 0
startLine : 0
url :
}
}
// Copyright 2018 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.
(async function test(){
const {session, contextGroup, Protocol} = InspectorTest.start(
'Debugger.scriptParsed.stackTrace should contain only one frame');
const { Debugger, Runtime } = Protocol;
await Debugger.enable();
Debugger.setAsyncCallStackDepth({ maxDepth: 32 });
Runtime.evaluate({ expression: `setTimeout(() => eval(''), 0)` });
await Debugger.onceScriptParsed();
InspectorTest.logMessage(await Debugger.onceScriptParsed());
InspectorTest.completeTest();
})()
......@@ -53,6 +53,8 @@ InspectorTest.logMessage = function(originalMessage) {
if (stableId)
stableId.value[stableIdSymbol] = true;
}
if (name === 'parentId')
return { id: '<id>' };
if (val && val[stableIdSymbol])
return '<StablectObjectId>';
return val;
......
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