Chromium Code Reviews| 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 async instrumentation enabled in the middle.'); | |
| 6 | |
| 7 InspectorTest.addScript(` | |
| 8 function foo() { | |
| 9 // asyncTaskStarted | |
| 10 debugger; | |
| 11 // asyncTaskFinished | |
| 12 debugger; | |
| 13 } | |
| 14 | |
| 15 function test() { | |
| 16 var resolve1; | |
| 17 var p1 = new Promise(resolve => resolve1 = resolve); | |
| 18 var p2 = p1.then(foo); | |
| 19 debugger; | |
| 20 resolve1(); // asyncTaskScheduled | |
| 21 debugger; | |
| 22 return p2; | |
| 23 } | |
| 24 | |
| 25 //# sourceURL=test.js`, 7, 26); | |
| 26 | |
| 27 InspectorTest.setupScriptMap(); | |
| 28 Protocol.Debugger.onPaused(message => { | |
| 29 if (enableOnPause-- === 0) | |
|
dgozman
2017/01/09 22:59:30
Declare this variable somewhere please.
kozy
2017/01/10 00:11:38
Done.
| |
| 30 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); | |
| 31 InspectorTest.logCallFrames(message.params.callFrames); | |
| 32 var asyncStackTrace = message.params.asyncStackTrace; | |
| 33 while (asyncStackTrace) { | |
| 34 InspectorTest.log(`-- ${asyncStackTrace.description} --`); | |
| 35 InspectorTest.logCallFrames(asyncStackTrace.callFrames); | |
| 36 asyncStackTrace = asyncStackTrace.parent; | |
| 37 } | |
| 38 InspectorTest.log(''); | |
| 39 Protocol.Debugger.resume(); | |
| 40 }); | |
| 41 | |
| 42 Protocol.Debugger.enable(); | |
| 43 InspectorTest.runTestSuite([ | |
| 44 function beforeAsyncTaskScheduled(next) { | |
| 45 enableOnPause = 0; | |
| 46 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr1.js', | |
| 47 awaitPromise: true }) | |
| 48 .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 })) | |
| 49 .then(next); | |
| 50 }, | |
| 51 | |
| 52 function afterAsyncTaskScheduled(next) { | |
| 53 enableOnPause = 2; | |
| 54 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr1.js', | |
| 55 awaitPromise: true }) | |
| 56 .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 })) | |
| 57 .then(next); | |
| 58 }, | |
| 59 | |
| 60 function afterAsyncTaskStarted(next) { | |
| 61 enableOnPause = 3; | |
| 62 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr1.js', | |
| 63 awaitPromise: true }) | |
| 64 .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 })) | |
| 65 .then(next); | |
| 66 } | |
| 67 ]); | |
| OLD | NEW |