2008-09-08 10:48:14 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
Tests of DOM Worker Threads (Bug 437152)
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for DOM Worker Threads (Bug 437152)</title>
|
|
|
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=437152">DOM Worker Threads Bug 437152</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
2008-11-04 18:58:24 -08:00
|
|
|
var pool = navigator.newWorkerPool();
|
|
|
|
pool.messageListener = function(message, source) {
|
|
|
|
switch (message) {
|
2008-09-08 10:48:14 -07:00
|
|
|
case "started":
|
2008-11-04 18:58:24 -08:00
|
|
|
source.postMessage("stop");
|
2008-09-08 10:48:14 -07:00
|
|
|
break;
|
|
|
|
case "stopped":
|
|
|
|
SimpleTest.finish();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(false, "Unexpected message:" + message);
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-11-04 18:58:24 -08:00
|
|
|
pool.errorListener = function(error, source) {
|
|
|
|
ok(false, "Worker had an error:" + error);
|
2008-09-08 10:48:14 -07:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
2008-11-04 18:58:24 -08:00
|
|
|
var worker = pool.createWorkerFromURL("importScripts_worker.js");
|
2008-09-08 10:48:14 -07:00
|
|
|
worker.postMessage("start");
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|