summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/WorkerDebuggerGlobalScope.enterEventLoop_worker.js
blob: 7b30109615bcaae2d4fcb96b8e15eefa410d4a87 (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
28
29
"use strict";

function f() {
  // eslint-disable-next-line no-debugger
  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":
      // eslint-disable-next-line no-debugger
      debugger;
      postMessage("pong");
      break;
  }
};