Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / url / tests / jsm_url_worker.js
blobd4cabe41131eb2aabfa62782b8ce21798ae2f1ce
1 /* eslint-env worker */
3 onmessage = function (event) {
4   if (event.data != 0) {
5     var worker = new Worker("jsm_url_worker.js");
6     worker.onmessage = function (ev) {
7       postMessage(ev.data);
8     };
10     worker.postMessage(event.data - 1);
11     return;
12   }
14   let status = false;
15   try {
16     if (URL instanceof Object) {
17       status = true;
18     }
19   } catch (e) {}
21   postMessage({ type: "status", status, msg: "URL object:" + URL });
23   status = false;
24   var blob = null;
25   try {
26     blob = new Blob([]);
27     status = true;
28   } catch (e) {}
30   postMessage({ type: "status", status, msg: "Blob:" + blob });
32   status = false;
33   var url = null;
34   try {
35     url = URL.createObjectURL(blob);
36     status = true;
37   } catch (e) {}
39   postMessage({ type: "status", status, msg: "Blob URL:" + url });
41   status = false;
42   try {
43     URL.revokeObjectURL(url);
44     status = true;
45   } catch (e) {}
47   postMessage({ type: "status", status, msg: "Blob Revoke URL" });
49   status = false;
50   url = null;
51   try {
52     url = URL.createObjectURL(true);
53   } catch (e) {
54     status = true;
55   }
57   postMessage({
58     type: "status",
59     status,
60     msg: "CreateObjectURL should fail if the arg is not a blob",
61   });
63   status = false;
64   url = null;
65   try {
66     url = URL.createObjectURL(blob);
67     status = true;
68   } catch (e) {}
70   postMessage({ type: "status", status, msg: "Blob URL2:" + url });
72   status = false;
73   try {
74     URL.createObjectURL({});
75   } catch (e) {
76     status = true;
77   }
79   postMessage({ type: "status", status, msg: "Exception wanted" });
81   postMessage({ type: "url", url });
83   postMessage({ type: "finish" });