| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <body> | |
| 3 <p>Test that "error" event listener added with window.addEventListener is invoke
d for uncaucht exceptions. <a href="https://bugs.webkit.org/show_bug.cgi?id=8519
">Bug 8519</a>.</p> | |
| 4 <div id="console"></div> | |
| 5 <script> | |
| 6 if (window.testRunner) | |
| 7 testRunner.dumpAsText(); | |
| 8 | |
| 9 function log(msg) { | |
| 10 document.getElementById("console").innerHTML += msg + "<br>"; | |
| 11 } | |
| 12 | |
| 13 function lastPathComponent(url) { | |
| 14 return url ? url.match( /[^\/]+\/?$/ )[0] : url; | |
| 15 } | |
| 16 | |
| 17 window.addEventListener("error", function(e) { | |
| 18 log("event passed to the listener is the same as window.event: " + (window.e
vent === e)); | |
| 19 log("Event details:"); | |
| 20 log("type: " + e.type); | |
| 21 log("phase: " + e.eventPhase) | |
| 22 log("currentTarget is the global object: " + (e.currentTarget === window)); | |
| 23 log("message: " + e.message); | |
| 24 log("filename: " + lastPathComponent(e.filename)); | |
| 25 log("lineno: " + e.lineno); | |
| 26 e.preventDefault(); | |
| 27 }, false); | |
| 28 | |
| 29 throw new Error("My fault."); | |
| 30 | |
| 31 </script> | |
| 32 </body> | |
| 33 </html> | |
| OLD | NEW |