2011-07-17 23:09:13 +04:00
|
|
|
<!--
|
|
|
|
Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
-->
|
2008-09-08 21:48:14 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
Tests of DOM Worker Threads (Bug 437152)
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for DOM Worker Threads (Bug 437152)</title>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2008-09-08 21:48:14 +04:00
|
|
|
<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">
|
2020-06-18 01:45:31 +03:00
|
|
|
|
2008-09-08 21:48:14 +04:00
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
2008-11-06 09:41:52 +03:00
|
|
|
var worker = new Worker("importScripts_worker.js");
|
|
|
|
|
|
|
|
worker.onmessage = function(event) {
|
|
|
|
switch (event.data) {
|
2008-09-08 21:48:14 +04:00
|
|
|
case "started":
|
2008-11-06 09:41:52 +03:00
|
|
|
worker.postMessage("stop");
|
2008-09-08 21:48:14 +04:00
|
|
|
break;
|
|
|
|
case "stopped":
|
2009-03-19 02:59:31 +03:00
|
|
|
ok(true, "worker correctly stopped");
|
2008-09-08 21:48:14 +04:00
|
|
|
SimpleTest.finish();
|
|
|
|
break;
|
|
|
|
default:
|
2009-01-13 21:43:23 +03:00
|
|
|
ok(false, "Unexpected message:" + event.data);
|
2008-09-08 21:48:14 +04:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-11-06 09:41:52 +03:00
|
|
|
worker.onerror = function(event) {
|
2009-01-13 21:43:23 +03:00
|
|
|
ok(false, "Worker had an error:" + event.message);
|
2008-09-08 21:48:14 +04:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
worker.postMessage("start");
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2008-11-06 09:41:52 +03:00
|
|
|
|
2008-09-08 21:48:14 +04:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|