summaryrefslogtreecommitdiff
path: root/cli/tests/subdir/test_worker.js
blob: 4260975a668cfb29d32cf004fdb7a22ea057160f (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 !== "") {
  throw Error(`Bad worker name: ${self.name}, expected empty string.`);
}

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

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

onerror = function () {
  return false;
};