Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / debugger / debugger-terminate-dedicated-worker-while-paused.html
blobd5f83d469b68e7a49a6c752939633d0af1376774
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
7 var worker;
9 function startWorkerAndRunTest()
11 worker = new Worker("resources/dedicated-worker.js");
12 worker.onmessage = function(event) { };
13 worker.postMessage(1);
14 log("Started worker");
15 runTest();
19 function test()
22 var workerId;
23 var workerRequestId = 1;
24 function sendCommandToWorker(method, params)
26 InspectorTest.sendCommand("Worker.sendMessageToWorker",
28 "workerId": workerId,
29 "message": JSON.stringify({ "method": method,
30 "params": params,
31 "id": workerRequestId++ })
32 });
35 function didEnableWorkerDebugging(messageObject)
37 if ("error" in messageObject) {
38 InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
39 InspectorTest.completeTest();
42 InspectorTest.sendCommand("Worker.enable", {}, didEnableWorkerDebugging);
45 InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject)
47 workerId = messageObject["params"]["workerId"];
48 InspectorTest.log("Worker created");
49 InspectorTest.sendCommand("Worker.connectToWorker", { "workerId": workerId }, didConnectToWorker);
51 function didConnectToWorker(messageObject)
53 InspectorTest.log("didConnectToWorker");
54 sendCommandToWorker("Debugger.enable", {});
55 sendCommandToWorker("Debugger.pause", {});
59 InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject)
61 var message = JSON.parse(messageObject["params"]["message"]);
62 if (message["method"] === "Debugger.paused") {
63 InspectorTest.log("Worker paused");
64 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "worker.terminate()" }, didTerminateWorker);
68 function didTerminateWorker(messageObject)
70 InspectorTest.log("SUCCESS: Did terminate paused worker");
71 InspectorTest.completeTest();
75 </script>
76 </head>
77 <body onLoad="startWorkerAndRunTest();">Test that inspected page won't crash if inspected worker is terminated while it is paused. Test passes if it doesn't crash.
78 <a href="https://bugs.webkit.org/show_bug.cgi?id=101065">Bug 101065.</a>
79 </body>
80 </html>