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 print('Checks that async stacks works for async/await'); | 5 print('Checks that async stacks works for async/await'); |
6 | 6 |
7 InspectorTest.addScript(` | 7 InspectorTest.addScript(` |
8 async function foo1() { | 8 async function foo1() { |
9 debugger; | 9 debugger; |
10 return Promise.resolve(); | 10 return Promise.resolve(); |
(...skipping 12 matching lines...) Expand all Loading... |
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 InspectorTest.setupScriptMap(); |
29 Protocol.Debugger.onPaused(message => { | 29 Protocol.Debugger.onPaused(message => { |
30 InspectorTest.logCallFrames(message.params.callFrames); | 30 InspectorTest.logCallFrames(message.params.callFrames); |
31 var asyncStackTrace = message.params.asyncStackTrace; | 31 var asyncStackTrace = message.params.asyncStackTrace; |
32 while (asyncStackTrace) { | 32 while (asyncStackTrace) { |
33 InspectorTest.log(`-- ${asyncStackTrace.description} --`); | 33 if (asyncStackTrace.promiseCreationFrame) { |
| 34 var frame = asyncStackTrace.promiseCreationFrame; |
| 35 InspectorTest.log(`-- ${asyncStackTrace.description} (${frame.url |
| 36 }:${frame.lineNumber}:${frame.columnNumber})--`); |
| 37 } else { |
| 38 InspectorTest.log(`-- ${asyncStackTrace.description} --`); |
| 39 } |
34 InspectorTest.logCallFrames(asyncStackTrace.callFrames); | 40 InspectorTest.logCallFrames(asyncStackTrace.callFrames); |
35 asyncStackTrace = asyncStackTrace.parent; | 41 asyncStackTrace = asyncStackTrace.parent; |
36 } | 42 } |
37 InspectorTest.log(''); | 43 InspectorTest.log(''); |
38 Protocol.Debugger.resume(); | 44 Protocol.Debugger.resume(); |
39 }); | 45 }); |
40 | 46 |
41 Protocol.Debugger.enable(); | 47 Protocol.Debugger.enable(); |
42 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); | 48 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); |
43 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js', | 49 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js', |
44 awaitPromise: true }) | 50 awaitPromise: true }) |
45 .then(InspectorTest.logMessage) | 51 .then(InspectorTest.logMessage) |
46 .then(InspectorTest.completeTest); | 52 .then(InspectorTest.completeTest); |
OLD | NEW |