Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!-- |
michael@0 | 2 | Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | --> |
michael@0 | 5 | <!DOCTYPE HTML> |
michael@0 | 6 | <html> |
michael@0 | 7 | <head> |
michael@0 | 8 | <meta charset="utf-8"> |
michael@0 | 9 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"> |
michael@0 | 10 | </script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <iframe id="workerFrame" src="errorPropagation_iframe.html" |
michael@0 | 15 | onload="workerFrameLoaded();"></iframe> |
michael@0 | 16 | <script type="text/javascript"> |
michael@0 | 17 | const workerCount = 3; |
michael@0 | 18 | |
michael@0 | 19 | const errorMessage = "Error: expectedError"; |
michael@0 | 20 | const errorFilename = "http://mochi.test:8888/tests/dom/workers/test/" + |
michael@0 | 21 | "errorPropagation_worker.js"; |
michael@0 | 22 | const errorLineno = 48; |
michael@0 | 23 | |
michael@0 | 24 | var workerFrame; |
michael@0 | 25 | |
michael@0 | 26 | scopeErrorCount = 0; |
michael@0 | 27 | workerErrorCount = 0; |
michael@0 | 28 | windowErrorCount = 0; |
michael@0 | 29 | |
michael@0 | 30 | function messageListener(event) { |
michael@0 | 31 | if (event.type == "scope") { |
michael@0 | 32 | scopeErrorCount++; |
michael@0 | 33 | } |
michael@0 | 34 | else if (event.type == "worker") { |
michael@0 | 35 | workerErrorCount++; |
michael@0 | 36 | } |
michael@0 | 37 | else if (event.type == "window") { |
michael@0 | 38 | windowErrorCount++; |
michael@0 | 39 | } |
michael@0 | 40 | else { |
michael@0 | 41 | ok(false, "Bad event type: " + event.type); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | is(event.data.message, errorMessage, "Correct message event.message"); |
michael@0 | 45 | is(event.data.filename, errorFilename, |
michael@0 | 46 | "Correct message event.filename"); |
michael@0 | 47 | is(event.data.lineno, errorLineno, "Correct message event.lineno"); |
michael@0 | 48 | |
michael@0 | 49 | if (windowErrorCount == 1) { |
michael@0 | 50 | is(scopeErrorCount, workerCount, "Good number of scope errors"); |
michael@0 | 51 | is(workerErrorCount, workerCount, "Good number of worker errors"); |
michael@0 | 52 | workerFrame.stop(); |
michael@0 | 53 | SimpleTest.finish(); |
michael@0 | 54 | } |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | function workerFrameLoaded() { |
michael@0 | 58 | workerFrame = document.getElementById("workerFrame").contentWindow; |
michael@0 | 59 | workerFrame.start(workerCount, messageListener); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 63 | </script> |
michael@0 | 64 | </body> |
michael@0 | 65 | </html> |
michael@0 | 66 |