| 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 InspectorTest.evaluateInPage( | |
| 6 `function testFunction() | |
| 7 { | |
| 8 function foo() | |
| 9 { | |
| 10 try { | |
| 11 throw new Error(); | |
| 12 } catch (e) { | |
| 13 } | |
| 14 } | |
| 15 debugger; | |
| 16 foo(); | |
| 17 console.log("completed"); | |
| 18 }`); | |
| 19 | |
| 20 InspectorTest.sendCommandOrDie("Debugger.enable", {}); | |
| 21 InspectorTest.sendCommandOrDie("Runtime.enable", {}); | |
| 22 step1(); | |
| 23 | |
| 24 function step1() | |
| 25 { | |
| 26 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setTimeout
(testFunction, 0);"}); | |
| 27 var commands = [ "Print", "stepOver", "stepOver", "Print", "resume" ]; | |
| 28 InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) | |
| 29 { | |
| 30 var command = commands.shift(); | |
| 31 if (command === "Print") { | |
| 32 var callFrames = messageObject.params.callFrames; | |
| 33 for (var callFrame of callFrames) | |
| 34 InspectorTest.log(callFrame.functionName + ":" + callFrame.location.line
Number); | |
| 35 command = commands.shift(); | |
| 36 } | |
| 37 if (command) | |
| 38 InspectorTest.sendCommandOrDie("Debugger." + command, {}); | |
| 39 } | |
| 40 | |
| 41 InspectorTest.eventHandler["Runtime.consoleAPICalled"] = function(messageObjec
t) | |
| 42 { | |
| 43 if (messageObject.params.args[0].value === "completed") { | |
| 44 if (commands.length) | |
| 45 InspectorTest.log("[FAIL]: execution was resumed too earlier.") | |
| 46 step2(); | |
| 47 } | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 function step2() | |
| 52 { | |
| 53 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setTimeout
(testFunction, 0);"}); | |
| 54 var commands = [ "Print", "stepOver", "stepInto", "stepOver", "stepOver", "Pri
nt", "resume" ]; | |
| 55 InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) | |
| 56 { | |
| 57 var command = commands.shift(); | |
| 58 if (command === "Print") { | |
| 59 var callFrames = messageObject.params.callFrames; | |
| 60 for (var callFrame of callFrames) | |
| 61 InspectorTest.log(callFrame.functionName + ":" + callFrame.location.line
Number); | |
| 62 command = commands.shift(); | |
| 63 } | |
| 64 if (command) | |
| 65 InspectorTest.sendCommandOrDie("Debugger." + command, {}); | |
| 66 } | |
| 67 | |
| 68 InspectorTest.eventHandler["Runtime.consoleAPICalled"] = function(messageObjec
t) | |
| 69 { | |
| 70 if (messageObject.params.args[0].value === "completed") { | |
| 71 if (commands.length) | |
| 72 InspectorTest.log("[FAIL]: execution was resumed too earlier.") | |
| 73 InspectorTest.completeTest(); | |
| 74 } | |
| 75 } | |
| 76 } | |
| OLD | NEW |