summaryrefslogtreecommitdiffstats
path: root/dom/xhr/tests/worker_temporaryFileBlob.js
blob: 056b826e0079a658a58247f649f224cee9a1eda0 (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
30
31
32
33
/* eslint-env worker */

/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */

importScripts("common_temporaryFileBlob.js");

function info(msg) {
  postMessage({ type: "info", msg });
}

function ok(a, msg) {
  postMessage({ type: "check", what: !!a, msg });
}

function is(a, b, msg) {
  ok(a === b, msg);
}

function next() {
  postMessage({ type: "finish" });
}

onmessage = function (e) {
  if (e.data == "simple") {
    test_simple();
  } else if (e.data == "abort") {
    test_abort();
  } else if (e.data == "reuse") {
    test_reuse();
  } else {
    ok(false, "Something wrong happened");
  }
};