summaryrefslogtreecommitdiff
path: root/cli/tests/subdir/test_worker.js
blob: 02cd86eacd5965eedcf3d186408b1bcbe863bf08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
let thrown = false;

if (self.name !== "jsWorker") {
  throw Error(`Bad worker name: ${self.name}, expected jsWorker`);
}

onmessage = function (e) {
  if (thrown === false) {
    thrown = true;
    throw new SyntaxError("[test error]");
  }

  postMessage(e.data);
  close();
};

onerror = function () {
  return false;
};