| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 InspectorTest.log('Checks that async stacks works for async/await'); | 5 let {session, contextGroup, Protocol} = InspectorTest.start('Checks that async s
tacks works for async/await'); |
| 6 | 6 |
| 7 InspectorTest.addScript(` | 7 contextGroup.addScript(` |
| 8 async function foo1() { | 8 async function foo1() { |
| 9 debugger; | 9 debugger; |
| 10 return Promise.resolve(); | 10 return Promise.resolve(); |
| 11 } | 11 } |
| 12 | 12 |
| 13 async function foo2() { | 13 async function foo2() { |
| 14 await Promise.resolve(); | 14 await Promise.resolve(); |
| 15 debugger; | 15 debugger; |
| 16 await Promise.resolve(); | 16 await Promise.resolve(); |
| 17 debugger; | 17 debugger; |
| 18 await foo1(); | 18 await foo1(); |
| 19 await Promise.all([ Promise.resolve() ]).then(foo1); | 19 await Promise.all([ Promise.resolve() ]).then(foo1); |
| 20 debugger; | 20 debugger; |
| 21 } | 21 } |
| 22 | 22 |
| 23 async function test() { | 23 async function test() { |
| 24 await foo2(); | 24 await foo2(); |
| 25 } | 25 } |
| 26 //# sourceURL=test.js`, 7, 26); | 26 //# sourceURL=test.js`, 7, 26); |
| 27 | 27 |
| 28 InspectorTest.setupScriptMap(); | 28 session.setupScriptMap(); |
| 29 Protocol.Debugger.onPaused(message => { | 29 Protocol.Debugger.onPaused(message => { |
| 30 InspectorTest.logCallFrames(message.params.callFrames); | 30 session.logCallFrames(message.params.callFrames); |
| 31 InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); | 31 session.logAsyncStackTrace(message.params.asyncStackTrace); |
| 32 InspectorTest.log(''); | 32 InspectorTest.log(''); |
| 33 Protocol.Debugger.resume(); | 33 Protocol.Debugger.resume(); |
| 34 }); | 34 }); |
| 35 | 35 |
| 36 Protocol.Debugger.enable(); | 36 Protocol.Debugger.enable(); |
| 37 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); | 37 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); |
| 38 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js', | 38 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js', |
| 39 awaitPromise: true }) | 39 awaitPromise: true }) |
| 40 .then(InspectorTest.logMessage) | 40 .then(InspectorTest.logMessage) |
| 41 .then(InspectorTest.completeTest); | 41 .then(InspectorTest.completeTest); |
| OLD | NEW |