gecko/dom/src/threads/test/test_importScripts.html

50 lines
1.3 KiB
HTML
Raw Normal View History

<!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) {
case "started":
2008-11-04 18:58:24 -08:00
source.postMessage("stop");
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);
SimpleTest.finish();
}
2008-11-04 18:58:24 -08:00
var worker = pool.createWorkerFromURL("importScripts_worker.js");
worker.postMessage("start");
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>