OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 if (window.testRunner) | 4 if (window.testRunner) |
5 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
6 | 6 |
7 function print(message, color) | 7 function print(message, color) |
8 { | 8 { |
9 var paragraph = document.createElement("div"); | 9 var paragraph = document.createElement("div"); |
10 paragraph.appendChild(document.createTextNode(message)); | 10 paragraph.appendChild(document.createTextNode(message)); |
11 paragraph.style.fontFamily = "monospace"; | 11 paragraph.style.fontFamily = "monospace"; |
12 if (color) | 12 if (color) |
13 paragraph.style.color = color; | 13 paragraph.style.color = color; |
14 document.getElementById("console").appendChild(paragraph); | 14 document.getElementById("console").appendChild(paragraph); |
15 } | 15 } |
16 | 16 |
17 function test() | 17 function test() |
18 { | 18 { |
19 // must be last because the exception ends JavaScript execution | 19 // must be last because the exception ends JavaScript execution |
20 window.onerror = function (error, url, line) { | 20 window.onerror = function (error, url, line, column) { |
21 url = url ? url.match( /[^\/]+\/?$/ )[0] : url; | 21 url = url ? url.match( /[^\/]+\/?$/ )[0] : url; |
22 print("PASS: caught global error: " + error + " at " + url + ":" + line,
"green"); | 22 print("PASS: caught global error: " + error + " at " + url + ", line: "
+ line + ", column: " + column, "green"); |
23 return true; | 23 return true; |
24 }; | 24 }; |
25 hahaha_good_luck_finding_me(); // caught by window.onerror | 25 hahaha_good_luck_finding_me(); // caught by window.onerror |
26 } | 26 } |
27 </script> | 27 </script> |
28 </head> | 28 </head> |
29 <body onload="test();"> | 29 <body onload="test();"> |
30 <p>This page tests setting onerror handlers through the DOM. If it passes, you w
ill | 30 <p>This page tests setting onerror handlers through the DOM. If it passes, you w
ill |
31 see "PASS" messages below.<a href="https://bugs.webkit.org/show_bug.cgi?id=85
19">Bug 8519</a>.</p> | 31 see "PASS" messages below.<a href="https://bugs.webkit.org/show_bug.cgi?id=85
19">Bug 8519</a>.</p> |
32 <hr> | 32 <hr> |
33 <div id='console'></div> | 33 <div id='console'></div> |
34 </body> | 34 </body> |
35 </html> | 35 </html> |
OLD | NEW |