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 | |
6 | |
7 var worker; | |
8 | |
9 function startWorkerAndRunTest() | |
10 { | |
11 worker = new Worker("resources/dedicated-worker.js"); | |
12 worker.onmessage = function(event) { }; | |
13 worker.postMessage(1); | |
14 log("Started worker"); | |
15 runTest(); | |
16 } | |
17 | |
18 | |
19 function test() | |
20 { | |
21 | |
22 var workerId; | |
23 var workerRequestId = 1; | |
24 function sendCommandToWorker(method, params) | |
25 { | |
26 InspectorTest.sendCommand("Target.sendMessageToTarget", | |
27 { | |
28 "targetId": workerId, | |
29 "message": JSON.stringify({ "method": method, | |
30 "params": params, | |
31 "id": workerRequestId++ }) | |
32 }); | |
33 } | |
34 | |
35 function didEnableWorkerDebugging(messageObject) | |
36 { | |
37 if ("error" in messageObject) { | |
38 InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messag
eObject.error.message); | |
39 InspectorTest.completeTest(); | |
40 } | |
41 } | |
42 InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitFor
DebuggerOnStart: false}, didEnableWorkerDebugging); | |
43 | |
44 | |
45 InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObje
ct) | |
46 { | |
47 workerId = messageObject["params"]["targetInfo"]["targetId"]; | |
48 InspectorTest.log("Worker created"); | |
49 InspectorTest.log("didConnectToWorker"); | |
50 sendCommandToWorker("Debugger.enable", {}); | |
51 sendCommandToWorker("Debugger.pause", {}); | |
52 } | |
53 | |
54 InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(me
ssageObject) | |
55 { | |
56 var message = JSON.parse(messageObject["params"]["message"]); | |
57 if (message["method"] === "Debugger.paused") { | |
58 InspectorTest.log("Worker paused"); | |
59 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "worke
r.terminate()" }, didTerminateWorker); | |
60 } | |
61 } | |
62 | |
63 function didTerminateWorker(messageObject) | |
64 { | |
65 InspectorTest.log("SUCCESS: Did terminate paused worker"); | |
66 InspectorTest.completeTest(); | |
67 } | |
68 | |
69 } | |
70 </script> | |
71 </head> | |
72 <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 cra
sh. | |
73 <a href="https://bugs.webkit.org/show_bug.cgi?id=101065">Bug 101065.</a> | |
74 </body> | |
75 </html> | |
OLD | NEW |