gecko-dev/dom/src/threads/test/test_recursion.html

53 lines
1.1 KiB
HTML
Raw Normal View History

2008-10-15 07:23:06 +00:00
<!DOCTYPE HTML>
<html>
<!--
Tests of DOM Worker Threads
-->
<head>
<title>Test for DOM Worker Threads Recursion</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>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
2008-11-05 02:58:24 +00:00
function workerScript() {
function recurse() {
recurse();
}
2008-10-15 07:23:06 +00:00
2008-11-05 02:58:24 +00:00
this.messageListener = function(message, source) {
switch (message) {
case "start":
recurse();
break;
default:
}
}
}
var pool = navigator.newWorkerPool();
pool.errorListener = function(error, source) {
is(error.message,
'[JavaScript Error: "too much recursion" {file: "DOMWorker inline ' +
'script" line: 4}]');
2008-10-15 07:23:06 +00:00
SimpleTest.finish();
}
2008-11-05 02:58:24 +00:00
var worker = pool.createWorker("(" + workerScript + ")();");
2008-10-15 07:23:06 +00:00
worker.postMessage("start");
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>