OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 4 <script> |
| 5 function testFunction() |
| 6 { |
| 7 function foo() |
| 8 { |
| 9 try { |
| 10 throw new Error(); |
| 11 } catch (e) { |
| 12 } |
| 13 } |
| 14 debugger; |
| 15 foo(); |
| 16 console.log("completed"); |
| 17 } |
| 18 </script> |
| 19 <script> |
| 20 function test() |
| 21 { |
| 22 InspectorTest.sendCommandOrDie("Debugger.enable", {} ); |
| 23 InspectorTest.sendCommandOrDie("Console.enable", {} ); |
| 24 step1(); |
| 25 |
| 26 function step1() |
| 27 { |
| 28 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setT
imeout(testFunction, 0);"} ); |
| 29 var commands = [ "Print", "stepOver", "stepOver", "Print", "resume" ]; |
| 30 InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) |
| 31 { |
| 32 var command = commands.shift(); |
| 33 if (command === "Print") { |
| 34 var callFrames = messageObject.params.callFrames; |
| 35 for (var callFrame of callFrames) |
| 36 InspectorTest.log(callFrame.functionName + ":" + callFrame.l
ocation.lineNumber); |
| 37 command = commands.shift(); |
| 38 } |
| 39 if (command) |
| 40 InspectorTest.sendCommandOrDie("Debugger." + command, {}); |
| 41 } |
| 42 |
| 43 InspectorTest.eventHandler["Console.messageAdded"] = function(messageObj
ect) |
| 44 { |
| 45 if (messageObject.params.message.text === "completed") { |
| 46 if (commands.length) |
| 47 InspectorTest.log("[FAIL]: execution was resumed too earlier
.") |
| 48 step2(); |
| 49 } |
| 50 } |
| 51 } |
| 52 |
| 53 function step2() |
| 54 { |
| 55 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setT
imeout(testFunction, 0);"} ); |
| 56 var commands = [ "Print", "stepOver", "stepInto", "stepOver", "stepOver"
, "Print", "resume" ]; |
| 57 InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) |
| 58 { |
| 59 var command = commands.shift(); |
| 60 if (command === "Print") { |
| 61 var callFrames = messageObject.params.callFrames; |
| 62 for (var callFrame of callFrames) |
| 63 InspectorTest.log(callFrame.functionName + ":" + callFrame.l
ocation.lineNumber); |
| 64 command = commands.shift(); |
| 65 } |
| 66 if (command) |
| 67 InspectorTest.sendCommandOrDie("Debugger." + command, {}); |
| 68 } |
| 69 |
| 70 InspectorTest.eventHandler["Console.messageAdded"] = function(messageObj
ect) |
| 71 { |
| 72 if (messageObject.params.message.text === "completed") { |
| 73 if (commands.length) |
| 74 InspectorTest.log("[FAIL]: execution was resumed too earlier
.") |
| 75 InspectorTest.completeTest(); |
| 76 } |
| 77 } |
| 78 } |
| 79 } |
| 80 </script> |
| 81 </head> |
| 82 <body onLoad="runTest();"></body> |
| 83 </html> |
OLD | NEW |