| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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('Check that continue-to-location works with different strategi
es.'); | 5 let {session, contextGroup, Protocol} = InspectorTest.start('Check that continue
-to-location works with different strategies.'); |
| 6 | 6 |
| 7 InspectorTest.addScript(` | 7 contextGroup.addScript(` |
| 8 async function asyncFact(n) { | 8 async function asyncFact(n) { |
| 9 if (n == 0) return 1; | 9 if (n == 0) return 1; |
| 10 let r = n * await asyncFact(n - 1); | 10 let r = n * await asyncFact(n - 1); |
| 11 console.log(r); | 11 console.log(r); |
| 12 return r; | 12 return r; |
| 13 } | 13 } |
| 14 | 14 |
| 15 function fact(n) { | 15 function fact(n) { |
| 16 if (n == 0) return 1; | 16 if (n == 0) return 1; |
| 17 let r = n * fact(n - 1); | 17 let r = n * fact(n - 1); |
| 18 console.log(r); | 18 console.log(r); |
| 19 return r; | 19 return r; |
| 20 } | 20 } |
| 21 | 21 |
| 22 function topLevel() { | 22 function topLevel() { |
| 23 eval(` + '`' + ` | 23 eval(` + '`' + ` |
| 24 var a = 1; | 24 var a = 1; |
| 25 var b = 2; | 25 var b = 2; |
| 26 fact(3); | 26 fact(3); |
| 27 console.log(a + b); | 27 console.log(a + b); |
| 28 ` + '`' + `); | 28 ` + '`' + `); |
| 29 } | 29 } |
| 30 | 30 |
| 31 //# sourceURL=test.js`, 7, 26); | 31 //# sourceURL=test.js`, 7, 26); |
| 32 | 32 |
| 33 InspectorTest.setupScriptMap(); | 33 session.setupScriptMap(); |
| 34 InspectorTest.runAsyncTestSuite([ | 34 InspectorTest.runAsyncTestSuite([ |
| 35 async function testAwaitAny() { | 35 async function testAwaitAny() { |
| 36 Protocol.Debugger.enable(); | 36 Protocol.Debugger.enable(); |
| 37 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); | 37 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); |
| 38 Protocol.Debugger.pause(); | 38 Protocol.Debugger.pause(); |
| 39 Protocol.Runtime.evaluate({expression: 'asyncFact(4)//# sourceURL=expr.js'})
; | 39 Protocol.Runtime.evaluate({expression: 'asyncFact(4)//# sourceURL=expr.js'})
; |
| 40 await pausedAndDumpStack(); | 40 await pausedAndDumpStack(); |
| 41 Protocol.Debugger.stepInto(); | 41 Protocol.Debugger.stepInto(); |
| 42 let message = await pausedAndDumpStack(); | 42 let message = await pausedAndDumpStack(); |
| 43 let location = message.params.callFrames[0].location; | 43 let location = message.params.callFrames[0].location; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 location.lineNumber = 4; | 125 location.lineNumber = 4; |
| 126 Protocol.Debugger.continueToLocation({location, targetCallFrames: 'current'}
); | 126 Protocol.Debugger.continueToLocation({location, targetCallFrames: 'current'}
); |
| 127 await pausedAndDumpStack(); | 127 await pausedAndDumpStack(); |
| 128 await Protocol.Debugger.resume(); | 128 await Protocol.Debugger.resume(); |
| 129 Protocol.Debugger.disable(); | 129 Protocol.Debugger.disable(); |
| 130 } | 130 } |
| 131 ]); | 131 ]); |
| 132 | 132 |
| 133 async function pausedAndDumpStack() { | 133 async function pausedAndDumpStack() { |
| 134 let message = await Protocol.Debugger.oncePaused(); | 134 let message = await Protocol.Debugger.oncePaused(); |
| 135 InspectorTest.logCallFrames(message.params.callFrames); | 135 session.logCallFrames(message.params.callFrames); |
| 136 InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); | 136 session.logAsyncStackTrace(message.params.asyncStackTrace); |
| 137 InspectorTest.log(''); | 137 InspectorTest.log(''); |
| 138 return message; | 138 return message; |
| 139 } | 139 } |
| OLD | NEW |