Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: LayoutTests/fast/workers/worker-script-error.html

Issue 20679002: Add 'colno' attribute to ErrorEvent interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <body> 1 <body>
2 <p>Test Worker script error handling functionality. Should print a series of PAS S messages, followed with DONE.</p> 2 <p>Test Worker script error handling functionality. Should print a series of PAS S messages, followed with DONE.</p>
3 <div id=result></div> 3 <div id=result></div>
4 <script> 4 <script>
5 function log(message) 5 function log(message)
6 { 6 {
7 document.getElementById("result").innerHTML += message + "<br>"; 7 document.getElementById("result").innerHTML += message + "<br>";
8 } 8 }
9 9
10 var testCases = [ 10 var testCases = [
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 log("FAIL: unexpected exception " + ex); 44 log("FAIL: unexpected exception " + ex);
45 runNextTest(); 45 runNextTest();
46 } 46 }
47 } 47 }
48 48
49 function testScriptErrorUnhandled() 49 function testScriptErrorUnhandled()
50 { 50 {
51 try { 51 try {
52 var worker = new Worker("resources/worker-script-error-unhandled.js"); 52 var worker = new Worker("resources/worker-script-error-unhandled.js");
53 worker.onerror = function(evt) { 53 worker.onerror = function(evt) {
54 log("PASS: onerror invoked for a script that has script error '" + e vt.message + "' at line " + evt.lineno + "."); 54 log("PASS: onerror invoked for a script that has script error '" + e vt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
55 runNextTest(); 55 runNextTest();
56 return false; 56 return false;
57 } 57 }
58 } catch (ex) { 58 } catch (ex) {
59 log("FAIL: unexpected exception " + ex); 59 log("FAIL: unexpected exception " + ex);
60 runNextTest(); 60 runNextTest();
61 } 61 }
62 } 62 }
63 63
64 function testScriptErrorAddEventListener() 64 function testScriptErrorAddEventListener()
65 { 65 {
66 try { 66 try {
67 var worker = new Worker("resources/worker-script-error-unhandled.js"); 67 var worker = new Worker("resources/worker-script-error-unhandled.js");
68 worker.addEventListener("error", 68 worker.addEventListener("error",
69 function(evt) { 69 function(evt) {
70 log("PASS: event listener invoked for a script that has script e rror '" + evt.message + "' at line " + evt.lineno + "."); 70 log("PASS: event listener invoked for a script that has script e rror '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
71 runNextTest(); 71 runNextTest();
72 evt.preventDefault(); 72 evt.preventDefault();
73 }, false); 73 }, false);
74 } catch (ex) { 74 } catch (ex) {
75 log("FAIL: unexpected exception " + ex); 75 log("FAIL: unexpected exception " + ex);
76 runNextTest(); 76 runNextTest();
77 } 77 }
78 } 78 }
79 79
80 function testErrorInHandlingScriptError() 80 function testErrorInHandlingScriptError()
81 { 81 {
82 try { 82 try {
83 var worker = new Worker("resources/worker-error-in-handling-script-error .js"); 83 var worker = new Worker("resources/worker-error-in-handling-script-error .js");
84 var errorCount = 0; 84 var errorCount = 0;
85 worker.onerror = function(evt) { 85 worker.onerror = function(evt) {
86 log("PASS: onerror invoked for a script that has script error '" + e vt.message + "' at line " + evt.lineno + "."); 86 log("PASS: onerror invoked for a script that has script error '" + e vt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
87 ++errorCount; 87 ++errorCount;
88 // Second error happens in the onerror handler. Run next test only w hen it's reported. 88 // Second error happens in the onerror handler. Run next test only w hen it's reported.
89 if (errorCount == 2) 89 if (errorCount == 2)
90 runNextTest(); 90 runNextTest();
91 return false; 91 return false;
92 } 92 }
93 } catch (ex) { 93 } catch (ex) {
94 log("FAIL: unexpected exception " + ex); 94 log("FAIL: unexpected exception " + ex);
95 runNextTest(); 95 runNextTest();
96 } 96 }
97 } 97 }
98 98
99 function testScriptErrorBubbledAndHandledInWorker() 99 function testScriptErrorBubbledAndHandledInWorker()
100 { 100 {
101 try { 101 try {
102 var worker = new Worker("resources/worker-script-error-bubbled.js"); 102 var worker = new Worker("resources/worker-script-error-bubbled.js");
103 worker.onmessage = function(evt) { 103 worker.onmessage = function(evt) {
104 log("message from worker: \"" + evt.data + "\"."); 104 log("message from worker: \"" + evt.data + "\".");
105 } 105 }
106 worker.onerror = function(evt) { 106 worker.onerror = function(evt) {
107 log("PASS: onerror invoked for a script that has script error '" + e vt.message + "' at line " + evt.lineno + "."); 107 log("PASS: onerror invoked for a script that has script error '" + e vt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
108 runNextTest(); 108 runNextTest();
109 return false; 109 return false;
110 } 110 }
111 } catch (ex) { 111 } catch (ex) {
112 log("FAIL: unexpected exception " + ex); 112 log("FAIL: unexpected exception " + ex);
113 runNextTest(); 113 runNextTest();
114 } 114 }
115 } 115 }
116 116
117 function testScriptErrorBubbledAndReportedToUser() 117 function testScriptErrorBubbledAndReportedToUser()
118 { 118 {
119 try { 119 try {
120 var worker = new Worker("resources/worker-script-error-bubbled.js"); 120 var worker = new Worker("resources/worker-script-error-bubbled.js");
121 worker.onerror = function(evt) { 121 worker.onerror = function(evt) {
122 log("PASS: onerror invoked for a script that has script error '" + e vt.message + "' at line " + evt.lineno + "."); 122 log("PASS: onerror invoked for a script that has script error '" + e vt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
123 runNextTest(); 123 runNextTest();
124 return true; 124 return true;
125 } 125 }
126 } catch (ex) { 126 } catch (ex) {
127 log("FAIL: unexpected exception " + ex); 127 log("FAIL: unexpected exception " + ex);
128 runNextTest(); 128 runNextTest();
129 } 129 }
130 } 130 }
131 131
132 function testScriptErrorHandled() 132 function testScriptErrorHandled()
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (window.testRunner) { 166 if (window.testRunner) {
167 testRunner.dumpAsText(); 167 testRunner.dumpAsText();
168 testRunner.waitUntilDone(); 168 testRunner.waitUntilDone();
169 } 169 }
170 170
171 runNextTest(); 171 runNextTest();
172 172
173 </script> 173 </script>
174 </body> 174 </body>
175 175
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698