tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

urlSearchParams_worker.js (918B)


      1 /* eslint-env worker */
      2 
      3 importScripts("urlSearchParams_commons.js");
      4 
      5 function ok(a, msg) {
      6  dump("OK: " + !!a + "  =>  " + a + " " + msg + "\n");
      7  postMessage({ type: "status", status: !!a, msg: a + ": " + msg });
      8 }
      9 
     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  });
     17 }
     18 
     19 var tests = [
     20  testSimpleURLSearchParams,
     21  testCopyURLSearchParams,
     22  testParserURLSearchParams,
     23  testURL,
     24  testEncoding,
     25  testCTORs,
     26 ];
     27 
     28 function runTest() {
     29  if (!tests.length) {
     30    postMessage({ type: "finish" });
     31    return;
     32  }
     33 
     34  var test = tests.shift();
     35  test();
     36 }
     37 
     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/");
     46 
     47  runTest();
     48 };