summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/WorkerDebuggerGlobalScope.enterEventLoop_worker.js
blob: 8108a20289d06423832930a5d51e4116e4561de7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"use strict";

function f() {
  debugger;
}

var worker = new Worker(
  "WorkerDebuggerGlobalScope.enterEventLoop_childWorker.js"
);

worker.onmessage = function (event) {
  postMessage("child:" + event.data);
};

self.onmessage = function (event) {
  var message = event.data;
  if (message.includes(":")) {
    worker.postMessage(message.split(":")[1]);
    return;
  }
  switch (message) {
    case "ping":
      debugger;
      postMessage("pong");
      break;
  }
};