v8/test/inspector/runtime/set-max-call-stack-size.js
Hidy Han 9758552aa8 Add more support for flexible stack trace capturing.
1) Let firstNonEmptySourceURL traverse async stack trace (if any).
2) Expose Runtime.setMaxCallStackSizeToCapture API to control the number of frames to capture.

Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I72f021c6ae9e317af67c3114fd4860ce0f06d977
Reviewed-on: https://chromium-review.googlesource.com/1085643
Commit-Queue: Hidy Han <hidyhan@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Pavel Feldman <pfeldman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53506}
2018-06-04 22:59:12 +00:00

38 lines
1.2 KiB
JavaScript

// 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.
let {session, contextGroup, Protocol} = InspectorTest.start('Checks Runtime.setMaxCallStackSizeToCapture.');
Protocol.Runtime.enable();
Protocol.Runtime.onConsoleAPICalled(
message => InspectorTest.logMessage(message.params));
contextGroup.addScript(`
function bar() {
console.log("Nested call.");
}
function foo() {
bar();
}
async function test() {
setTimeout(foo, 0);
}
//# sourceURL=test.js`);
Protocol.Runtime.setAsyncCallStackDepth({maxDepth: 10});
(async function test() {
await Protocol.Runtime.setMaxCallStackSizeToCapture({size: 0});
InspectorTest.log('Test with max size 0.');
await Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js'});
await Protocol.Runtime.setMaxCallStackSizeToCapture({size: 1});
InspectorTest.log('Test with max size 1.');
await Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js'});
await Protocol.Runtime.setMaxCallStackSizeToCapture({size: 2});
InspectorTest.log('Test with max size 2.');
await Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js'});
InspectorTest.completeTest();
})();