toolkit/components/workerloader/tests/worker_handler.js

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:2a06c83c692b
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function worker_handler(worker) {
5 worker.onerror = function(error) {
6 error.preventDefault();
7 ok(false, "error "+error);
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