[Chromium] Unreviewed, mark fast/regions tests failing after r136045 as failing,...
[WebKit-https.git] / LayoutTests / inspector-protocol / debugger-terminate-dedicated-worker-while-paused.html
1 <html>
2 <head>
3 <script type="text/javascript" src="../http/tests/inspector-protocol/resources/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("Worker.sendMessageToWorker",
27             {
28                 "workerId": workerId,
29                 "message": { "method": method,
30                              "params": params,
31                              "id": workerRequestId++
32                            }
33             });
34     }
35
36     function didEnableWorkerDebugging(messageObject)
37     {
38         if ("error" in messageObject) {
39             InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
40             InspectorTest.completeTest();
41             return;
42         }
43         InspectorTest.log("didEnableWorkerDebugging");
44     }
45     InspectorTest.sendCommand("Worker.enable", {}, didEnableWorkerDebugging);
46
47
48     InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject)
49     {
50         workerId = messageObject["params"]["workerId"];
51         InspectorTest.log("Worker created");
52         InspectorTest.sendCommand("Worker.connectToWorker", { "workerId": workerId }, didConnectToWorker);
53
54         function didConnectToWorker(messageObject)
55         {
56             InspectorTest.log("didConnectToWorker");
57             sendCommandToWorker("Debugger.enable", {});
58             sendCommandToWorker("Debugger.pause", {});
59         }
60     }
61
62     InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject)
63     {
64         var message = messageObject["params"]["message"];
65         if (message["method"] === "Debugger.paused") {
66             InspectorTest.log("Worker paused");
67             InspectorTest.sendCommand("Runtime.evaluate", { "expression": "worker.terminate()" }, didTerminateWorker);
68         }
69     }
70
71     function didTerminateWorker(messageObject)
72     {
73         InspectorTest.log("SUCCESS: Did terminate paused worker");
74         InspectorTest.completeTest();
75     }
76
77 }
78 </script>
79 </head>
80 <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.
81 <a href="https://bugs.webkit.org/show_bug.cgi?id=101065">Bug 101065.</a>
82 </body>
83 </html>