OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 print('Checks that async stack contains setTimeout'); | |
6 | |
7 InspectorTest.addScript(` | |
8 function foo1() { | |
9 function inner1() { | |
10 debugger; | |
11 } | |
12 inner1(); | |
13 } | |
14 function foo2() { | |
15 function inner2() { | |
16 setTimeout(foo1, 0); | |
17 } | |
18 inner2(); | |
19 } | |
20 function foo3() { | |
21 function inner3() { | |
22 setTimeout(foo2, 0); | |
23 } | |
24 inner3(); | |
25 } | |
26 //# sourceURL=test.js`, 7, 26) | |
dgozman
2016/12/13 17:31:54
missing semicolon
kozy
2016/12/13 18:24:26
Done.
| |
27 | |
28 Protocol.Debugger.enable(); | |
29 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); | |
30 var urlByScriptId = new Map(); | |
31 Protocol.Debugger.onScriptParsed(message => { | |
32 urlByScriptId.set(message.params.scriptId, message.params.url); | |
dgozman
2016/12/13 17:31:54
Let's have a helper for this, something like Inspe
kozy
2016/12/13 18:24:26
Done.
| |
33 }); | |
34 Protocol.Debugger.onPaused(message => { | |
35 InspectorTest.logCallFrames(message.params.callFrames, urlByScriptId); | |
36 var asyncStackTrace = message.params.asyncStackTrace; | |
37 while (asyncStackTrace) { | |
38 InspectorTest.log(`-- ${asyncStackTrace.description} --`); | |
39 InspectorTest.logCallFrames(asyncStackTrace.callFrames); | |
40 asyncStackTrace = asyncStackTrace.parent; | |
41 } | |
42 InspectorTest.log(''); | |
43 Protocol.Debugger.resume(); | |
44 }); | |
45 Protocol.Runtime.evaluate({ expression: "foo3()//# sourceURL=expr.js" }) | |
46 .then(InspectorTest.completeTest); | |
OLD | NEW |