tor-browser

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

WorkerSimpleTest.js (962B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 function log(text) {
      5  dump("WORKER " + text + "\n");
      6 }
      7 
      8 function send(message) {
      9  self.postMessage(message);
     10 }
     11 
     12 function finish() {
     13  send({ kind: "finish" });
     14 }
     15 
     16 function ok(condition, description) {
     17  send({ kind: "ok", condition: !!condition, description: "" + description });
     18 }
     19 
     20 function is(a, b, description) {
     21  let outcome = a == b; // Need to decide outcome here, as not everything can be serialized
     22  send({
     23    kind: "is",
     24    outcome,
     25    description: "" + description,
     26    a: "" + a,
     27    b: "" + b,
     28  });
     29 }
     30 
     31 function isnot(a, b, description) {
     32  let outcome = a != b; // Need to decide outcome here, as not everything can be serialized
     33  send({
     34    kind: "isnot",
     35    outcome,
     36    description: "" + description,
     37    a: "" + a,
     38    b: "" + b,
     39  });
     40 }
     41 
     42 function info(description) {
     43  send({ kind: "info", description: "" + description });
     44 }