| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
| 4 <script> | |
| 5 var worker; | |
| 6 | |
| 7 function startWorker() | |
| 8 { | |
| 9 worker = new Worker("resources/dedicated-worker-step-into.js"); | |
| 10 worker.onmessage = function(event) { }; | |
| 11 worker.postMessage(1); | |
| 12 log("Started worker"); | |
| 13 } | |
| 14 | |
| 15 | |
| 16 function test() | |
| 17 { | |
| 18 | |
| 19 var workerId; | |
| 20 var workerRequestId = 1; | |
| 21 function sendCommandToWorker(method, params) | |
| 22 { | |
| 23 InspectorTest.sendCommand("Target.sendMessageToTarget", | |
| 24 { | |
| 25 "targetId": workerId, | |
| 26 "message": JSON.stringify({ "method": method, | |
| 27 "params": params, | |
| 28 "id": workerRequestId++ }) | |
| 29 }); | |
| 30 } | |
| 31 | |
| 32 function didEnableWorkerDebugging(messageObject) | |
| 33 { | |
| 34 if ("error" in messageObject) { | |
| 35 InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messag
eObject.error.message); | |
| 36 InspectorTest.completeTest(); | |
| 37 } | |
| 38 } | |
| 39 InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitFor
DebuggerOnStart: true}, didEnableWorkerDebugging); | |
| 40 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "startWorker()
" }); | |
| 41 | |
| 42 InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObje
ct) | |
| 43 { | |
| 44 workerId = messageObject["params"]["targetInfo"]["targetId"]; | |
| 45 InspectorTest.log("Worker created"); | |
| 46 sendCommandToWorker("Debugger.enable", {}); | |
| 47 sendCommandToWorker("Runtime.runIfWaitingForDebugger", {}); | |
| 48 } | |
| 49 | |
| 50 var pauseCount = 0; | |
| 51 InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(me
ssageObject) | |
| 52 { | |
| 53 var message = JSON.parse(messageObject["params"]["message"]); | |
| 54 if (message["method"] === "Debugger.paused") { | |
| 55 InspectorTest.log("SUCCESS: Worker paused"); | |
| 56 if (++pauseCount === 1) { | |
| 57 InspectorTest.log("Stepping into..."); | |
| 58 sendCommandToWorker("Debugger.stepInto", {}); | |
| 59 } else { | |
| 60 sendCommandToWorker("Debugger.disable", {}); | |
| 61 InspectorTest.completeTest(); | |
| 62 } | |
| 63 } | |
| 64 } | |
| 65 | |
| 66 } | |
| 67 </script> | |
| 68 </head> | |
| 69 <body onLoad="runTest();"> | |
| 70 <p>Tests that dedicated worker won't crash on attempt to step into.<a href="http
s://code.google.com/p/chromium/issues/detail?id=232392">Bug 232392.</a> | |
| 71 </p> | |
| 72 </body> | |
| 73 </html> | |
| OLD | NEW |