|
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 <head> |
|
8 <meta charset="utf-8"> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"> |
|
10 </script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
12 </head> |
|
13 <body> |
|
14 <iframe id="workerFrame" src="errorPropagation_iframe.html" |
|
15 onload="workerFrameLoaded();"></iframe> |
|
16 <script type="text/javascript"> |
|
17 const workerCount = 3; |
|
18 |
|
19 const errorMessage = "Error: expectedError"; |
|
20 const errorFilename = "http://mochi.test:8888/tests/dom/workers/test/" + |
|
21 "errorPropagation_worker.js"; |
|
22 const errorLineno = 48; |
|
23 |
|
24 var workerFrame; |
|
25 |
|
26 scopeErrorCount = 0; |
|
27 workerErrorCount = 0; |
|
28 windowErrorCount = 0; |
|
29 |
|
30 function messageListener(event) { |
|
31 if (event.type == "scope") { |
|
32 scopeErrorCount++; |
|
33 } |
|
34 else if (event.type == "worker") { |
|
35 workerErrorCount++; |
|
36 } |
|
37 else if (event.type == "window") { |
|
38 windowErrorCount++; |
|
39 } |
|
40 else { |
|
41 ok(false, "Bad event type: " + event.type); |
|
42 } |
|
43 |
|
44 is(event.data.message, errorMessage, "Correct message event.message"); |
|
45 is(event.data.filename, errorFilename, |
|
46 "Correct message event.filename"); |
|
47 is(event.data.lineno, errorLineno, "Correct message event.lineno"); |
|
48 |
|
49 if (windowErrorCount == 1) { |
|
50 is(scopeErrorCount, workerCount, "Good number of scope errors"); |
|
51 is(workerErrorCount, workerCount, "Good number of worker errors"); |
|
52 workerFrame.stop(); |
|
53 SimpleTest.finish(); |
|
54 } |
|
55 } |
|
56 |
|
57 function workerFrameLoaded() { |
|
58 workerFrame = document.getElementById("workerFrame").contentWindow; |
|
59 workerFrame.start(workerCount, messageListener); |
|
60 } |
|
61 |
|
62 SimpleTest.waitForExplicitFinish(); |
|
63 </script> |
|
64 </body> |
|
65 </html> |
|
66 |