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 else | |
lushnikov
2016/04/19 18:35:39
nit: remove if-else
kozy
2016/04/19 18:44:17
Done.
| |
42 InspectorTest.eventHandler["Debugger.paused"] = undefined; | |
43 } | |
44 | |
45 InspectorTest.eventHandler["Console.messageAdded"] = function(messageObj ect) | |
46 { | |
47 if (messageObject.params.message.text === "completed") { | |
48 if (commands.length) | |
49 InspectorTest.log("[FAIL]: execution was resumed too earlier .") | |
50 step2(); | |
51 } | |
52 } | |
53 } | |
54 | |
55 function step2() | |
56 { | |
57 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setT imeout(testFunction, 0);"} ); | |
58 var commands = [ "Print", "stepOver", "stepInto", "stepOver", "stepOver" , "Print", "resume" ]; | |
59 InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) | |
60 { | |
61 var command = commands.shift(); | |
62 if (command === "Print") { | |
63 var callFrames = messageObject.params.callFrames; | |
64 for (var callFrame of callFrames) | |
65 InspectorTest.log(callFrame.functionName + ":" + callFrame.l ocation.lineNumber); | |
66 command = commands.shift(); | |
67 } | |
68 if (command) | |
69 InspectorTest.sendCommandOrDie("Debugger." + command, {}); | |
70 } | |
71 | |
72 InspectorTest.eventHandler["Console.messageAdded"] = function(messageObj ect) | |
73 { | |
74 if (messageObject.params.message.text === "completed") { | |
75 if (commands.length) | |
76 InspectorTest.log("[FAIL]: execution was resumed too earlier .") | |
77 InspectorTest.completeTest(); | |
78 } | |
79 } | |
80 } | |
81 } | |
82 </script> | |
83 </head> | |
84 <body onLoad="runTest();"></body> | |
85 </html> | |
OLD | NEW |