| <html> |
| <head> |
| <script type="text/javascript" src="../http/tests/inspector-protocol/resources/protocol-test.js"></script> |
| <script> |
| var worker; |
| |
| function startWorker() |
| { |
| worker = new Worker("resources/dedicated-worker-step-into.js"); |
| worker.onmessage = function(event) { }; |
| worker.postMessage(1); |
| log("Started worker"); |
| } |
| |
| |
| function test() |
| { |
| |
| var workerId; |
| var workerRequestId = 1; |
| function sendCommandToWorker(method, params) |
| { |
| InspectorTest.sendCommand("Worker.sendMessageToWorker", |
| { |
| "workerId": workerId, |
| "message": { "method": method, |
| "params": params, |
| "id": workerRequestId++ } |
| }); |
| } |
| |
| function didEnableWorkerDebugging(messageObject) |
| { |
| if ("error" in messageObject) { |
| InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message); |
| InspectorTest.completeTest(); |
| } |
| } |
| InspectorTest.sendCommand("Worker.enable", {}, didEnableWorkerDebugging); |
| InspectorTest.sendCommand("Worker.setAutoconnectToWorkers", { "value": true }); |
| InspectorTest.sendCommand("Runtime.evaluate", { "expression": "startWorker()" }); |
| |
| InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject) |
| { |
| workerId = messageObject["params"]["workerId"]; |
| InspectorTest.log("Worker created"); |
| sendCommandToWorker("Debugger.enable", {}); |
| sendCommandToWorker("Runtime.run", {}); |
| } |
| |
| var pauseCount = 0; |
| InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject) |
| { |
| var message = messageObject["params"]["message"]; |
| if (message["method"] === "Debugger.paused") { |
| InspectorTest.log("SUCCESS: Worker paused"); |
| if (++pauseCount === 1) { |
| InspectorTest.log("Stepping into..."); |
| sendCommandToWorker("Debugger.stepInto", {}); |
| } else { |
| sendCommandToWorker("Debugger.disable", {}); |
| InspectorTest.completeTest(); |
| } |
| } |
| } |
| |
| } |
| </script> |
| </head> |
| <body onLoad="runTest();"> |
| <p>Tests that dedicated worker won't crash on attempt to step into.<a href="https://code.google.com/p/chromium/issues/detail?id=232392">Bug 232392.</a> |
| </p> |
| </body> |
| </html> |