dom/workers/test/test_errorPropagation.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial