toolkit/components/workerloader/tests/utils_worker.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/workerloader/tests/utils_worker.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function log(text) {
     1.8 +  dump("WORKER " + text + "\n");
     1.9 +}
    1.10 +
    1.11 +function send(message) {
    1.12 +  self.postMessage(message);
    1.13 +}
    1.14 +
    1.15 +function finish() {
    1.16 +  send({kind: "finish"});
    1.17 +}
    1.18 +
    1.19 +function ok(condition, description) {
    1.20 +  send({kind: "ok", condition: !!condition, description: "" + description});
    1.21 +}
    1.22 +
    1.23 +function is(a, b, description) {
    1.24 +  let outcome = a == b; // Need to decide outcome here, as not everything can be serialized
    1.25 +  send({kind: "is", outcome: outcome, description: "" + description, a: "" + a, b: "" + b});
    1.26 +}
    1.27 +
    1.28 +function isnot(a, b, description) {
    1.29 +  let outcome = a != b; // Need to decide outcome here, as not everything can be serialized
    1.30 +  send({kind: "isnot", outcome: outcome, description: "" + description, a: "" + a, b: "" + b});
    1.31 +}
    1.32 +
    1.33 +function info(description) {
    1.34 +  send({kind: "info", description: "" + description});
    1.35 +}

mercurial