summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html
diff options
context:
space:
mode:
authorsergeyv@chromium.org <sergeyv@chromium.org>2014-09-19 14:16:46 +0000
committersergeyv@chromium.org <sergeyv@chromium.org>2014-09-19 14:16:46 +0000
commit0f5161088df67b8c432e2a6c4c06c503844673f3 (patch)
tree6a36b3d9be38302ae58f16c10164155a2d62fcb9 /third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html
parentb4ba78a2cca24e886055ac377a796017fecff482 (diff)
downloadchromium_src-0f5161088df67b8c432e2a6c4c06c503844673f3.zip
chromium_src-0f5161088df67b8c432e2a6c4c06c503844673f3.tar.gz
chromium_src-0f5161088df67b8c432e2a6c4c06c503844673f3.tar.bz2
DevTools: unify scheduled action in a worker and a page, so we do not set a wrong url to a script
BUG=415058 Review URL: https://codereview.chromium.org/582423002 git-svn-id: svn://svn.chromium.org/blink/trunk@182330 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html')
-rw-r--r--third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html83
1 files changed, 83 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html
new file mode 100644
index 0000000..e49d79d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-setTimeout-sourceUrl-dedicated-worker-loop.html
@@ -0,0 +1,83 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script>
+
+var worker;
+function startWorkerAndRunTest()
+{
+ worker = new Worker("resources/dedicated-worker-string-setTimeout.js");
+ log("Started worker");
+ runTest();
+}
+
+function test()
+{
+ var workerId;
+ var workerRequestId = 1;
+ function sendCommandToWorker(method, params)
+ {
+ InspectorTest.sendCommand("Worker.sendMessageToWorker",
+ {
+ "workerId": workerId,
+ "message": { "method": method,
+ "params": params,
+ "id": workerRequestId }
+ });
+ return workerRequestId++;
+ }
+
+ function didEnableWorkerDebugging(messageObject)
+ {
+ if ("error" in messageObject) {
+ InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
+ InspectorTest.completeTest();
+ }
+ }
+ InspectorTest.sendCommand("Worker.enable", {}, didEnableWorkerDebugging);
+
+ var debuggerEnableRequestId = -1;
+ InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject)
+ {
+ workerId = messageObject["params"]["workerId"];
+ InspectorTest.log("Worker created");
+ InspectorTest.sendCommand("Worker.connectToWorker", { "workerId": workerId }, didConnectToWorker);
+
+ function didConnectToWorker(messageObject)
+ {
+ InspectorTest.log("didConnectToWorker");
+ debuggerEnableRequestId = sendCommandToWorker("Debugger.enable", {});
+ }
+ }
+
+ var postMessageToWorker = false;
+
+ InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject)
+ {
+ var message = messageObject["params"]["message"];
+ if (message["id"] === debuggerEnableRequestId) {
+ InspectorTest.log("Did enable debugger");
+ // Start setTimeout.
+ InspectorTest.sendCommand("Runtime.evaluate", { "expression": "worker.postMessage(1)" }, didPostMessageToWorker);
+ function didPostMessageToWorker()
+ {
+ postMessageToWorker = true;
+ InspectorTest.log("Did post message to worker");
+ }
+ }
+
+ if (postMessageToWorker && message["method"] === "Debugger.scriptParsed") {
+ var sourceUrl = message["params"]["url"];
+ if (!sourceUrl)
+ InspectorTest.log("SUCCESS: script created from string parameter of setTimeout has no url");
+ else
+ InspectorTest.log("FAIL: script created from string parameter of setTimeout has url " + sourceUrl);
+ InspectorTest.completeTest();
+ }
+ }
+}
+</script>
+</head>
+<body onLoad="startWorkerAndRunTest();">
+</body>
+</html>