OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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.evaluateInPage( | 5 InspectorTest.addScript( |
6 `function bar() | 6 `function bar() |
7 { | 7 { |
8 return 42; | 8 return 42; |
9 }`); | 9 }`); |
10 | 10 |
11 InspectorTest.evaluateInPage( | 11 InspectorTest.addScript( |
12 `function foo() | 12 `function foo() |
13 { | 13 { |
14 var a = bar(); | 14 var a = bar(); |
15 return a + 1; | 15 return a + 1; |
16 } | 16 } |
17 //# sourceURL=foo.js`); | 17 //# sourceURL=foo.js`); |
18 | 18 |
19 InspectorTest.evaluateInPage( | 19 InspectorTest.addScript( |
20 `function qwe() | 20 `function qwe() |
21 { | 21 { |
22 var a = foo(); | 22 var a = foo(); |
23 return a + 1; | 23 return a + 1; |
24 } | 24 } |
25 //# sourceURL=qwe.js`); | 25 //# sourceURL=qwe.js`); |
26 | 26 |
27 InspectorTest.evaluateInPage( | 27 InspectorTest.addScript( |
28 `function baz() | 28 `function baz() |
29 { | 29 { |
30 var a = qwe(); | 30 var a = qwe(); |
31 return a + 1; | 31 return a + 1; |
32 } | 32 } |
33 //# sourceURL=baz.js`); | 33 //# sourceURL=baz.js`); |
34 | 34 |
35 InspectorTest.sendCommand("Debugger.enable", {}); | 35 Protocol.Debugger.enable(); |
36 InspectorTest.sendCommand("Debugger.setBlackboxPatterns", { patterns: [ "foo(["
] }, dumpError); | 36 Protocol.Debugger.setBlackboxPatterns({ patterns: [ "foo([" ] }).then(dumpError)
; |
37 | 37 |
38 function dumpError(message) | 38 function dumpError(message) |
39 { | 39 { |
40 InspectorTest.log(message.error.message); | 40 InspectorTest.log(message.error.message); |
41 InspectorTest.eventHandler["Debugger.paused"] = dumpStackAndRunNextCommand; | 41 Protocol.Debugger.onPaused(dumpStackAndRunNextCommand); |
42 InspectorTest.sendCommandOrDie("Debugger.setBlackboxPatterns", { patterns: [ "
baz\.js", "foo\.js" ] }); | 42 Protocol.Debugger.setBlackboxPatterns({ patterns: [ "baz\.js", "foo\.js" ] }); |
43 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "debugger;b
az()" }); | 43 Protocol.Runtime.evaluate({ "expression": "debugger;baz()" }); |
44 } | 44 } |
45 | 45 |
46 var commands = [ "stepInto", "stepInto", "stepInto", "stepOut", "stepInto", "ste
pInto" ]; | 46 var commands = [ "stepInto", "stepInto", "stepInto", "stepOut", "stepInto", "ste
pInto" ]; |
47 function dumpStackAndRunNextCommand(message) | 47 function dumpStackAndRunNextCommand(message) |
48 { | 48 { |
49 InspectorTest.log("Paused in"); | 49 InspectorTest.log("Paused in"); |
50 var callFrames = message.params.callFrames; | 50 var callFrames = message.params.callFrames; |
51 for (var callFrame of callFrames) | 51 for (var callFrame of callFrames) |
52 InspectorTest.log((callFrame.functionName || "(...)") + ":" + (callFrame.loc
ation.lineNumber + 1)); | 52 InspectorTest.log((callFrame.functionName || "(...)") + ":" + (callFrame.loc
ation.lineNumber + 1)); |
53 var command = commands.shift(); | 53 var command = commands.shift(); |
54 if (!command) { | 54 if (!command) { |
55 InspectorTest.completeTest(); | 55 InspectorTest.completeTest(); |
56 return; | 56 return; |
57 } | 57 } |
58 InspectorTest.sendCommandOrDie("Debugger." + command, {}); | 58 Protocol.Debugger[command](); |
59 } | 59 } |
OLD | NEW |