2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
8 Tests of DOM Worker Threads with Fibonacci
11 <title>Test for DOM Worker Threads with Fibonacci
</title>
12 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
13 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
16 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=450452">DOM Worker Threads Fibonacci
</a>
18 <div id=
"content" style=
"display: none">
22 <script class=
"testbody" type=
"text/javascript">
26 function recursivefib(n) {
27 return n <
2 ? n : recursivefib(n -
1) + recursivefib(n -
2);
30 var worker = new Worker(
"fibonacci_worker.js");
32 worker.onmessage = function(event) {
33 is(event.target, worker);
34 is(event.data, recursivefib(seqNum));
38 worker.onerror = function(event) {
39 is(event.target, worker);
40 ok(false,
"Worker had an error: " + event.message);
44 worker.postMessage(seqNum);
46 SimpleTest.waitForExplicitFinish();