2012-06-28 18:56:53 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
function log(text) {
|
|
|
|
dump("WORKER "+text+"\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
function send(message) {
|
|
|
|
self.postMessage(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
self.onmessage = function(msg) {
|
|
|
|
self.onmessage = function(msg) {
|
|
|
|
log("ignored message "+JSON.stringify(msg.data));
|
|
|
|
};
|
2013-04-24 05:36:10 -07:00
|
|
|
let isDebugBuild = msg.data;
|
2012-06-28 18:56:53 -07:00
|
|
|
try {
|
2012-07-03 15:40:53 -07:00
|
|
|
test_name();
|
2012-06-28 18:56:53 -07:00
|
|
|
test_xul();
|
2013-04-24 05:36:10 -07:00
|
|
|
test_debugBuildWorkerThread(isDebugBuild);
|
2012-06-28 18:56:53 -07:00
|
|
|
} catch (x) {
|
|
|
|
log("Catching error: " + x);
|
|
|
|
log("Stack: " + x.stack);
|
|
|
|
log("Source: " + x.toSource());
|
|
|
|
ok(false, x.toString() + "\n" + x.stack);
|
|
|
|
}
|
|
|
|
finish();
|
|
|
|
};
|
|
|
|
|
|
|
|
function finish() {
|
|
|
|
send({kind: "finish"});
|
|
|
|
}
|
|
|
|
|
|
|
|
function ok(condition, description) {
|
|
|
|
send({kind: "ok", condition: condition, description:description});
|
|
|
|
}
|
|
|
|
function is(a, b, description) {
|
|
|
|
send({kind: "is", a: a, b:b, description:description});
|
|
|
|
}
|
|
|
|
function isnot(a, b, description) {
|
|
|
|
send({kind: "isnot", a: a, b:b, description:description});
|
|
|
|
}
|
|
|
|
|
2012-07-03 15:40:53 -07:00
|
|
|
// Test that OS.Constants.Sys.Name is defined
|
|
|
|
function test_name() {
|
|
|
|
isnot(null, OS.Constants.Sys.Name, "OS.Constants.Sys.Name is defined");
|
|
|
|
}
|
|
|
|
|
2013-04-24 05:36:10 -07:00
|
|
|
// Test that OS.Constants.Sys.DEBUG is set properly in ChromeWorker thread
|
|
|
|
function test_debugBuildWorkerThread(isDebugBuild) {
|
|
|
|
is(isDebugBuild, !!OS.Constants.Sys.DEBUG, "OS.Constants.Sys.DEBUG is set properly on worker thread");
|
|
|
|
}
|
|
|
|
|
2012-07-03 15:40:53 -07:00
|
|
|
// Test that OS.Constants.Path.libxul lets us open libxul
|
2012-06-28 18:56:53 -07:00
|
|
|
function test_xul() {
|
|
|
|
let lib;
|
2012-07-03 15:40:53 -07:00
|
|
|
isnot(null, OS.Constants.Path.libxul, "libxul is defined");
|
2012-06-28 18:56:53 -07:00
|
|
|
try {
|
2012-07-03 15:40:53 -07:00
|
|
|
lib = ctypes.open(OS.Constants.Path.libxul);
|
2012-06-28 18:56:53 -07:00
|
|
|
lib.declare("DumpJSStack", ctypes.default_abi, ctypes.void_t);
|
|
|
|
} catch (x) {
|
2012-07-03 15:40:53 -07:00
|
|
|
ok(false, "test_xul: Could not open libxul: " + x);
|
2012-06-28 18:56:53 -07:00
|
|
|
}
|
|
|
|
if (lib) {
|
|
|
|
lib.close();
|
|
|
|
}
|
2012-07-03 15:40:53 -07:00
|
|
|
ok(true, "test_xul: opened libxul successfully");
|
2012-06-28 18:56:53 -07:00
|
|
|
}
|