v8/test/inspector/debugger/async-stack-load-more.js
Benedikt Meurer b345204579 [inspector] Make inspector tests independent of Debugger.CallFrame.url.
This is the second step towards moving away from sending `url` with
every call frame when emitting the `Debugger.paused` event.

Bug: chromium:1270316, chromium:1271078
Change-Id: Ib4f996024b5200cded155bd8a564d01d36856400
Doc: https://bit.ly/devtools-debugger-callframe-url
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3431485
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78906}
2022-02-02 14:34:08 +00:00

46 lines
1.5 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.
let {session, contextGroup, Protocol} = InspectorTest.start('Tests super long async stacks.');
contextGroup.addScript(`
function callWithAsyncStack(f, depth) {
if (depth === 0) {
f();
return;
}
wrapper = eval('(function call' + depth + '() { callWithAsyncStack(f, depth - 1) }) //# sourceURL=wrapper.js');
Promise.resolve().then(wrapper);
}
//# sourceURL=utils.js`);
session.setupScriptMap();
InspectorTest.runAsyncTestSuite([async function test() {
Protocol.Debugger.enable();
Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 4});
Protocol.Runtime.evaluate({
expression: 'callWithAsyncStack(() => {debugger}, 12)//# sourceURL=expr.js'
});
let {params} = await Protocol.Debugger.oncePaused();
let {callFrames, asyncStackTrace, externalAsyncStackTrace} = params;
while (true) {
session.logCallFrames(callFrames);
if (externalAsyncStackTrace) {
InspectorTest.log('(fetch parent..)');
asyncStackTrace = (await Protocol.Debugger.getStackTrace({
stackTraceId: externalAsyncStackTrace
})).result.stackTrace;
}
if (asyncStackTrace) {
InspectorTest.log('--' + asyncStackTrace.description + '--');
callFrames = asyncStackTrace.callFrames;
externalAsyncStackTrace = asyncStackTrace.parentId;
asyncStackTrace = asyncStackTrace.parent;
} else {
break;
}
}
}]);