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