| Index: test/inspector/debugger/async-stack-created-frame.js
|
| diff --git a/test/inspector/debugger/async-stack-created-frame.js b/test/inspector/debugger/async-stack-created-frame.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fc459b2138e93b3529893497dc0a7f8fd9525a7f
|
| --- /dev/null
|
| +++ b/test/inspector/debugger/async-stack-created-frame.js
|
| @@ -0,0 +1,125 @@
|
| +// 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.
|
| +
|
| +print('Checks created frame for async call chain');
|
| +
|
| +InspectorTest.addScript(
|
| + `
|
| +function foo1() {
|
| + debugger;
|
| +}
|
| +
|
| +function foo2() {
|
| + debugger;
|
| +}
|
| +
|
| +function promise() {
|
| + var resolve;
|
| + var p1 = new Promise(r => resolve = r);
|
| + var p2 = p1.then(foo1);
|
| + resolve();
|
| + return p2;
|
| +}
|
| +
|
| +function promiseThen() {
|
| + var resolve;
|
| + var p1 = new Promise(r => resolve = r);
|
| + var p2 = p1.then(foo1);
|
| + var p3 = p2.then(foo2);
|
| + resolve();
|
| + return p3;
|
| +}
|
| +
|
| +function promiseResolve() {
|
| + return Promise.resolve().then(foo1);
|
| +}
|
| +
|
| +function promiseReject() {
|
| + return Promise.reject().catch(foo1);
|
| +}
|
| +
|
| +function promiseAll() {
|
| + return Promise.all([ Promise.resolve() ]).then(foo1);
|
| +}
|
| +
|
| +function promiseRace() {
|
| + return Promise.race([ Promise.resolve() ]).then(foo1);
|
| +}
|
| +
|
| +//# sourceURL=test.js`,
|
| + 8, 4);
|
| +
|
| +InspectorTest.setupScriptMap();
|
| +Protocol.Debugger.onPaused(message => {
|
| + InspectorTest.logCallFrames(message.params.callFrames);
|
| + var asyncStackTrace = message.params.asyncStackTrace;
|
| + while (asyncStackTrace) {
|
| + InspectorTest.log(`-- ${asyncStackTrace.description} --`);
|
| + InspectorTest.logCallFrames(asyncStackTrace.callFrames);
|
| + if (asyncStackTrace.creationFrame) {
|
| + InspectorTest.log('--- created in ---');
|
| + InspectorTest.logCallFrames([asyncStackTrace.creationFrame]);
|
| + }
|
| + asyncStackTrace = asyncStackTrace.parent;
|
| + }
|
| + InspectorTest.log('');
|
| + Protocol.Debugger.resume();
|
| +});
|
| +
|
| +Protocol.Debugger.enable();
|
| +Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128});
|
| +
|
| +InspectorTest.runTestSuite([
|
| + function testPromise(next) {
|
| + Protocol.Runtime
|
| + .evaluate(
|
| + {expression: 'promise()//# sourceURL=expr.js', awaitPromise: true})
|
| + .then(next);
|
| + },
|
| +
|
| + function testPromiseThen(next) {
|
| + Protocol.Runtime
|
| + .evaluate({
|
| + expression: 'promiseThen()//# sourceURL=expr.js',
|
| + awaitPromise: true
|
| + })
|
| + .then(next);
|
| + },
|
| +
|
| + function testPromiseResolve(next) {
|
| + Protocol.Runtime
|
| + .evaluate({
|
| + expression: 'promiseResolve()//# sourceURL=expr.js',
|
| + awaitPromise: true
|
| + })
|
| + .then(next);
|
| + },
|
| +
|
| + function testPromiseReject(next) {
|
| + Protocol.Runtime
|
| + .evaluate({
|
| + expression: 'promiseReject()//# sourceURL=expr.js',
|
| + awaitPromise: true
|
| + })
|
| + .then(next);
|
| + },
|
| +
|
| + function testPromiseAll(next) {
|
| + Protocol.Runtime
|
| + .evaluate({
|
| + expression: 'promiseAll()//# sourceURL=expr.js',
|
| + awaitPromise: true
|
| + })
|
| + .then(next);
|
| + },
|
| +
|
| + function testPromiseRace(next) {
|
| + Protocol.Runtime
|
| + .evaluate({
|
| + expression: 'promiseRace()//# sourceURL=expr.js',
|
| + awaitPromise: true
|
| + })
|
| + .then(next);
|
| + }
|
| +]);
|
|
|