Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
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 }