3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
9 worker
= new Worker("resources/dedicated-worker-suspend-setTimeout.js");
10 worker
.onmessage = function(event
) { };
11 worker
.postMessage(1);
12 log("Started worker");
20 var workerRequestId
= 1;
21 function sendCommandToWorker(method
, params
)
23 var requestId
= workerRequestId
++;
24 InspectorTest
.sendCommand("Worker.sendMessageToWorker",
27 "message": JSON
.stringify({ "method": method
,
34 function didEnableWorkerDebugging(messageObject
)
36 if ("error" in messageObject
) {
37 InspectorTest
.log("FAIL: Couldn't enable worker debugger: " + messageObject
.error
.message
);
38 InspectorTest
.completeTest();
41 InspectorTest
.sendCommand("Worker.enable", {}, didEnableWorkerDebugging
);
42 InspectorTest
.sendCommand("Worker.setAutoconnectToWorkers", { "value": true });
43 InspectorTest
.sendCommand("Runtime.evaluate", { "expression": "startWorker()" });
45 InspectorTest
.eventHandler
["Worker.workerCreated"] = function(messageObject
)
47 workerId
= messageObject
["params"]["workerId"];
48 InspectorTest
.log("Worker created");
49 sendCommandToWorker("Debugger.enable", {});
50 sendCommandToWorker("Runtime.run", {});
55 InspectorTest
.eventHandler
["Worker.dispatchMessageFromWorker"] = function(messageObject
)
57 var message
= JSON
.parse(messageObject
["params"]["message"]);
58 if (message
["method"] === "Debugger.paused") {
59 InspectorTest
.log("SUCCESS: Worker paused");
60 if (++pauseCount
=== 1) {
61 evalRequestId
= sendCommandToWorker("Runtime.evaluate", { "expression": "global_value" });
63 InspectorTest
.log("FAIL: debugger paused second time");
64 InspectorTest
.completeTest();
66 } else if (evalRequestId
&& message
["id"] === evalRequestId
) {
67 var value
= message
["result"]["result"]["value"];
69 InspectorTest
.log("SUCCESS: global_value is 1");
71 InspectorTest
.log("FAIL: setTimeout callback fired while script execution was paused");
72 sendCommandToWorker("Debugger.disable", {});
73 InspectorTest
.completeTest();
79 <body onLoad=
"runTest();">
80 <p>Tests that setTimeout callback will not fire while script execution is paused.
<a href=
"https://code.google.com/p/chromium/issues/detail?id=377926">Bug
377926.
</a>