toolkit/components/workerloader/tests/utils_mainthread.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function worker_handler(worker) {
     5   worker.onerror = function(error) {
     6     error.preventDefault();
     7     ok(false, "error "+ error.message);
     8   };
     9   worker.onmessage = function(msg) {
    10 //    ok(true, "MAIN: onmessage " + JSON.stringify(msg.data));
    11     switch (msg.data.kind) {
    12     case "is":
    13       SimpleTest.ok(msg.data.outcome, msg.data.description +
    14          "( "+ msg.data.a + " ==? " + msg.data.b + ")" );
    15       return;
    16     case "isnot":
    17       SimpleTest.ok(msg.data.outcome, msg.data.description +
    18       "( "+ msg.data.a + " !=? " + msg.data.b + ")" );
    19          return;
    20     case "ok":
    21       SimpleTest.ok(msg.data.condition, msg.data.description);
    22       return;
    23     case "info":
    24       SimpleTest.info(msg.data.description);
    25       return;
    26     case "finish":
    27       SimpleTest.finish();
    28       return;
    29     default:
    30       SimpleTest.ok(false, "test_osfile.xul: wrong message " + JSON.stringify(msg.data));
    31       return;
    32     }
    33   };
    34 }

mercurial