[WK2] selection does not disappear after coping the text
[framework/web/webkit-efl.git] / LayoutTests / fast / workers / shared-worker-script-error.html
1 <body>
2 <p>Test SharedWorker script error handling functionality. Should print a series of PASS messages, followed with DONE.</p>
3 <div id=result></div>
4 <script>
5 function log(message)
6 {
7     document.getElementById("result").innerHTML += message + "<br>";
8 }
9
10 var testCases = [
11     "testScriptErrorUnhandled",
12     "testScriptErrorHandled"
13 ];
14 var testIndex = 0;
15
16 function runNextTest()
17 {
18     if (testIndex < testCases.length) {
19         testIndex++;
20         try {
21             window[testCases[testIndex - 1]]();
22         } catch (ex) {
23             log("FAIL: unexpected exception " + ex);
24             runNextTest();
25         }
26     } else {
27         log("DONE");
28         // Wait briefly to make sure that any pending console messages get written out so they don't spill over into subsequent tests and cause failures.
29         setTimeout(function() {
30             if (window.layoutTestController)
31                 layoutTestController.notifyDone();
32         }, 10);
33     }
34 }
35
36 function testScriptErrorUnhandled()
37 {
38     var worker = new SharedWorker("resources/shared-worker-script-error.js", "name");
39     // SharedWorkers should only invoke onerror for loading errors.
40     worker.onerror = function(evt) {
41         log("FAIL: onerror invoked for a script error");
42     };
43     worker.port.postMessage("unhandledError");
44     worker.port.onmessage = function(evt) {
45         log(evt.data);
46         runNextTest();
47     }
48 }
49
50 function testScriptErrorHandled()
51 {
52     var worker = new SharedWorker("resources/shared-worker-script-error.js", "name2");
53     // SharedWorkers should only invoke onerror for loading errors.
54     worker.onerror = function(evt) {
55         log("FAIL: onerror invoked for a script error");
56     };
57     worker.port.postMessage("handledError");
58     worker.port.onmessage = function(evt) {
59         log(evt.data);
60         runNextTest();
61     }
62 }
63
64 if (window.layoutTestController) {
65     layoutTestController.dumpAsText();
66     layoutTestController.waitUntilDone();
67 }
68
69 runNextTest();
70
71 </script>
72 </body>
73