|
1 <!-- |
|
2 Any copyright is dedicated to the Public Domain. |
|
3 http://creativecommons.org/publicdomain/zero/1.0/ |
|
4 --> |
|
5 <!DOCTYPE HTML> |
|
6 <html> |
|
7 <!-- |
|
8 Tests of DOM Worker Threads |
|
9 --> |
|
10 <head> |
|
11 <title>Test for DOM Worker Threads Recursion</title> |
|
12 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
13 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
14 </head> |
|
15 <body> |
|
16 <p id="display"></p> |
|
17 <div id="content" style="display: none"> |
|
18 |
|
19 </div> |
|
20 <pre id="test"> |
|
21 <script class="testbody" type="text/javascript"> |
|
22 |
|
23 var worker = new Worker("throwingOnerror_worker.js"); |
|
24 |
|
25 var errors = ["foo", "bar"]; |
|
26 |
|
27 worker.onerror = function(event) { |
|
28 event.preventDefault(); |
|
29 var found = false; |
|
30 for (var index in errors) { |
|
31 if (event.message == "InternalError: uncaught exception: " + errors[index]) { |
|
32 errors.splice(index, 1); |
|
33 found = true; |
|
34 break; |
|
35 } |
|
36 } |
|
37 is(found, true, "Unexpected error!"); |
|
38 }; |
|
39 |
|
40 worker.onmessage = function(event) { |
|
41 is(errors.length, 0, "Didn't see expected errors!"); |
|
42 SimpleTest.finish(); |
|
43 }; |
|
44 |
|
45 for (var i = 0; i < 2; i++) { |
|
46 worker.postMessage(""); |
|
47 } |
|
48 |
|
49 SimpleTest.waitForExplicitFinish(); |
|
50 |
|
51 </script> |
|
52 </pre> |
|
53 </body> |
|
54 </html> |