3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
9 function startWorkerAndRunTest()
11 worker
= new Worker("resources/dedicated-worker.js");
12 worker
.onmessage = function(event
) { };
13 worker
.postMessage(1);
14 log("Started worker");
23 var workerRequestId
= 1;
24 function sendCommandToWorker(method
, params
)
26 InspectorTest
.sendCommand("Worker.sendMessageToWorker",
29 "message": JSON
.stringify({ "method": method
,
31 "id": workerRequestId
++ })
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();
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>