OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
4 <script> | 4 <script> |
5 | 5 |
6 var worker1; | 6 var worker1; |
7 var worker2; | 7 var worker2; |
8 | 8 |
9 function startWorkers() | 9 function startWorkers() |
10 { | 10 { |
(...skipping 25 matching lines...) Expand all Loading... |
36 "params": params, | 36 "params": params, |
37 "id": workerRequestId++ }) | 37 "id": workerRequestId++ }) |
38 }); | 38 }); |
39 } | 39 } |
40 | 40 |
41 var waitForWorkers = 2; | 41 var waitForWorkers = 2; |
42 InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject) | 42 InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject) |
43 { | 43 { |
44 var workerId = messageObject["params"]["workerId"]; | 44 var workerId = messageObject["params"]["workerId"]; |
45 InspectorTest.log("Worker created"); | 45 InspectorTest.log("Worker created"); |
46 sendCommandToWorker("Console.enable", {}, workerId); | 46 sendCommandToWorker("Runtime.enable", {}, workerId); |
47 if (!--waitForWorkers) | 47 if (!--waitForWorkers) |
48 InspectorTest.sendCommandOrDie("Runtime.evaluate", { expression: "wo
rker1.postMessage(239);worker2.postMessage(42);" }); | 48 InspectorTest.sendCommandOrDie("Runtime.evaluate", { expression: "wo
rker1.postMessage(239);worker2.postMessage(42);" }); |
49 } | 49 } |
50 | 50 |
51 var workerTerminated = false; | 51 var workerTerminated = false; |
52 var messageReceived = false; | 52 var messageReceived = false; |
53 InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(me
ssageObject) | 53 InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(me
ssageObject) |
54 { | 54 { |
55 var message = JSON.parse(messageObject["params"]["message"]); | 55 var message = JSON.parse(messageObject["params"]["message"]); |
56 if (message["method"] === "Console.messageAdded") { | 56 if (message["method"] === "Runtime.exceptionThrown") { |
57 var callFrames = message.params.message.stack.callFrames; | 57 var callFrames = message.params.details.stack ? message.params.detai
ls.stack.callFrames : []; |
58 if (callFrames.length < 2 || callFrames[1].functionName !== "boo1") | 58 InspectorTest.log(callFrames.length > 0 ? "Message with stack trace
received." : "[FAIL] Message contains empty stack trace"); |
59 return; | |
60 InspectorTest.log(message.params.message.stack.callFrames.length > 0
? "Message with stack trace received." : "[FAIL] Message contains empty stack t
race"); | |
61 messageReceived = true; | 59 messageReceived = true; |
62 if (messageReceived && workerTerminated) | 60 if (messageReceived && workerTerminated) |
63 InspectorTest.completeTest(); | 61 InspectorTest.completeTest(); |
64 } | 62 } |
65 } | 63 } |
66 | 64 |
67 InspectorTest.eventHandler["Worker.workerTerminated"] = function(messageObje
ct) | 65 InspectorTest.eventHandler["Worker.workerTerminated"] = function(messageObje
ct) |
68 { | 66 { |
69 InspectorTest.eventHandler["Worker.workerTerminated"] = undefined; | 67 InspectorTest.eventHandler["Worker.workerTerminated"] = undefined; |
70 workerTerminated = true; | 68 workerTerminated = true; |
71 if (messageReceived && workerTerminated) | 69 if (messageReceived && workerTerminated) |
72 InspectorTest.completeTest(); | 70 InspectorTest.completeTest(); |
73 } | 71 } |
74 } | 72 } |
75 </script> | 73 </script> |
76 </head> | 74 </head> |
77 <body onload="runTest()">Tests that console message from worker contains stack t
race.</body> | 75 <body onload="runTest()">Tests that console message from worker contains stack t
race.</body> |
78 </html> | 76 </html> |
OLD | NEW |