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 // Embed a user function in the snapshot and step through it. | 5 // Embed a user function in the snapshot and step through it. |
6 | 6 |
7 // Flags: --embed 'function c(f, ...args) { return f(...args); }' | 7 // Flags: --embed 'function c(f, ...args) { return f(...args); }' |
8 | 8 |
9 InspectorTest.setupScriptMap(); | 9 let {session, contextGroup, Protocol} = InspectorTest.start('Tests that stepping
works on snapshotted function'); |
| 10 session.setupScriptMap(); |
10 | 11 |
11 InspectorTest.addScript(` | 12 contextGroup.addScript(` |
12 function test() { | 13 function test() { |
13 function f(x) { | 14 function f(x) { |
14 return x * 2; | 15 return x * 2; |
15 } | 16 } |
16 debugger; | 17 debugger; |
17 c(f, 2); | 18 c(f, 2); |
18 } | 19 } |
19 //# sourceURL=test.js`); | 20 //# sourceURL=test.js`); |
20 | 21 |
21 Protocol.Debugger.onPaused(message => { | 22 Protocol.Debugger.onPaused(message => { |
22 InspectorTest.log("paused"); | 23 InspectorTest.log("paused"); |
23 var frames = message.params.callFrames; | 24 var frames = message.params.callFrames; |
24 InspectorTest.logSourceLocation(frames[0].location); | 25 session.logSourceLocation(frames[0].location); |
25 Protocol.Debugger.stepInto(); | 26 Protocol.Debugger.stepInto(); |
26 }) | 27 }) |
27 | 28 |
28 Protocol.Debugger.enable() | 29 Protocol.Debugger.enable() |
29 .then(() => Protocol.Runtime.evaluate({ expression: 'test()' })) | 30 .then(() => Protocol.Runtime.evaluate({ expression: 'test()' })) |
30 .then(InspectorTest.completeTest); | 31 .then(InspectorTest.completeTest); |
OLD | NEW |