Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / url / tests / urlSearchParams_worker.js
blob7959fd7d1cf4fb8083f30a1c6acfcc8658958929
1 /* eslint-env worker */
3 importScripts("urlSearchParams_commons.js");
5 function ok(a, msg) {
6   dump("OK: " + !!a + "  =>  " + a + " " + msg + "\n");
7   postMessage({ type: "status", status: !!a, msg: a + ": " + msg });
10 function is(a, b, msg) {
11   dump("IS: " + (a === b) + "  =>  " + a + " | " + b + " " + msg + "\n");
12   postMessage({
13     type: "status",
14     status: a === b,
15     msg: a + " === " + b + ": " + msg,
16   });
19 var tests = [
20   testSimpleURLSearchParams,
21   testCopyURLSearchParams,
22   testParserURLSearchParams,
23   testURL,
24   testEncoding,
25   testCTORs,
28 function runTest() {
29   if (!tests.length) {
30     postMessage({ type: "finish" });
31     return;
32   }
34   var test = tests.shift();
35   test();
38 onmessage = function () {
39   let status = false;
40   try {
41     if (URLSearchParams instanceof Object) {
42       status = true;
43     }
44   } catch (e) {}
45   ok(status, "URLSearchParams in workers \\o/");
47   runTest();