michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function worker_handler(worker) { michael@0: worker.onerror = function(error) { michael@0: error.preventDefault(); michael@0: ok(false, "error "+ error.message); michael@0: }; michael@0: worker.onmessage = function(msg) { michael@0: // ok(true, "MAIN: onmessage " + JSON.stringify(msg.data)); michael@0: switch (msg.data.kind) { michael@0: case "is": michael@0: SimpleTest.ok(msg.data.outcome, msg.data.description + michael@0: "( "+ msg.data.a + " ==? " + msg.data.b + ")" ); michael@0: return; michael@0: case "isnot": michael@0: SimpleTest.ok(msg.data.outcome, msg.data.description + michael@0: "( "+ msg.data.a + " !=? " + msg.data.b + ")" ); michael@0: return; michael@0: case "ok": michael@0: SimpleTest.ok(msg.data.condition, msg.data.description); michael@0: return; michael@0: case "info": michael@0: SimpleTest.info(msg.data.description); michael@0: return; michael@0: case "finish": michael@0: SimpleTest.finish(); michael@0: return; michael@0: default: michael@0: SimpleTest.ok(false, "test_osfile.xul: wrong message " + JSON.stringify(msg.data)); michael@0: return; michael@0: } michael@0: }; michael@0: }