2017-04-20 15:49:02 +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.
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start('Checks that we collect obsolete async tasks with async stacks.');
|
2017-04-20 15:49:02 +00:00
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
contextGroup.addScript(`
|
2017-04-20 15:49:02 +00:00
|
|
|
function test() {
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.setMaxAsyncTaskStacks(128);
|
2017-11-21 15:42:43 +00:00
|
|
|
var p = Promise.resolve().then(() => 42);
|
2017-04-20 15:49:02 +00:00
|
|
|
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.dumpAsyncTaskStacksStateForTest();
|
|
|
|
inspector.setMaxAsyncTaskStacks(128);
|
|
|
|
inspector.dumpAsyncTaskStacksStateForTest();
|
2017-04-20 15:49:02 +00:00
|
|
|
|
|
|
|
p.then(() => 42).then(() => 239);
|
|
|
|
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.dumpAsyncTaskStacksStateForTest();
|
|
|
|
inspector.setMaxAsyncTaskStacks(128);
|
|
|
|
inspector.dumpAsyncTaskStacksStateForTest();
|
2017-04-20 15:49:02 +00:00
|
|
|
|
|
|
|
setTimeout(() => 42, 0);
|
|
|
|
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.dumpAsyncTaskStacksStateForTest();
|
|
|
|
inspector.setMaxAsyncTaskStacks(128);
|
|
|
|
inspector.dumpAsyncTaskStacksStateForTest();
|
2017-04-20 15:49:02 +00:00
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
(async function test() {
|
|
|
|
Protocol.Debugger.enable();
|
|
|
|
Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128});
|
|
|
|
await Protocol.Runtime.evaluate({expression: 'test()'});
|
|
|
|
InspectorTest.completeTest();
|
|
|
|
})()
|