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 // TODO(kozyatinskiy): on StepOut and probably StepNext at return position | 5 // TODO(kozyatinskiy): on StepOut and probably StepNext at return position |
6 // of async generator we should break at next instruction of resumed generator | 6 // of async generator we should break at next instruction of resumed generator |
7 // instead of next scheduled microtask. | 7 // instead of next scheduled microtask. |
8 | 8 |
9 InspectorTest.log('StepOut from return position of async function.'); | 9 let {session, contextGroup, Protocol} = InspectorTest.start('StepOut from return
position of async function.'); |
10 | 10 |
11 InspectorTest.addScript(` | 11 contextGroup.addScript(` |
12 async function testFunction() { | 12 async function testFunction() { |
13 async function foo() { | 13 async function foo() { |
14 var p = Promise.resolve(); | 14 var p = Promise.resolve(); |
15 await p; | 15 await p; |
16 p.then(() => 1); | 16 p.then(() => 1); |
17 debugger; | 17 debugger; |
18 return p; | 18 return p; |
19 } | 19 } |
20 await foo(); | 20 await foo(); |
21 } | 21 } |
22 `); | 22 `); |
23 | 23 |
24 InspectorTest.setupScriptMap(); | 24 session.setupScriptMap(); |
25 Protocol.Debugger.enable(); | 25 Protocol.Debugger.enable(); |
26 InspectorTest.runAsyncTestSuite([ | 26 InspectorTest.runAsyncTestSuite([ |
27 async function testStepInto() { | 27 async function testStepInto() { |
28 Protocol.Runtime.evaluate({expression: 'testFunction()'}); | 28 Protocol.Runtime.evaluate({expression: 'testFunction()'}); |
29 await logPauseLocation(await Protocol.Debugger.oncePaused()); | 29 await logPauseLocation(await Protocol.Debugger.oncePaused()); |
30 Protocol.Debugger.stepInto(); | 30 Protocol.Debugger.stepInto(); |
31 await logPauseLocation(await Protocol.Debugger.oncePaused()); | 31 await logPauseLocation(await Protocol.Debugger.oncePaused()); |
32 Protocol.Debugger.stepInto(); | 32 Protocol.Debugger.stepInto(); |
33 await logPauseLocation(await Protocol.Debugger.oncePaused()); | 33 await logPauseLocation(await Protocol.Debugger.oncePaused()); |
34 Protocol.Debugger.stepInto(); | 34 Protocol.Debugger.stepInto(); |
(...skipping 26 matching lines...) Expand all Loading... |
61 await logPauseLocation(await Protocol.Debugger.oncePaused()); | 61 await logPauseLocation(await Protocol.Debugger.oncePaused()); |
62 Protocol.Debugger.stepOut(); | 62 Protocol.Debugger.stepOut(); |
63 await logPauseLocation(await Protocol.Debugger.oncePaused()); | 63 await logPauseLocation(await Protocol.Debugger.oncePaused()); |
64 Protocol.Debugger.stepOut(); | 64 Protocol.Debugger.stepOut(); |
65 await logPauseLocation(await Protocol.Debugger.oncePaused()); | 65 await logPauseLocation(await Protocol.Debugger.oncePaused()); |
66 Protocol.Debugger.resume(); | 66 Protocol.Debugger.resume(); |
67 }, | 67 }, |
68 ]); | 68 ]); |
69 | 69 |
70 function logPauseLocation(message) { | 70 function logPauseLocation(message) { |
71 return InspectorTest.logSourceLocation(message.params.callFrames[0].location); | 71 return session.logSourceLocation(message.params.callFrames[0].location); |
72 } | 72 } |
OLD | NEW |