OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <p>Test that window.onerror and "error" event listeners from isolated world
are | 6 <p>Test that window.onerror and "error" event listeners from isolated world
are |
7 invoked for uncaught exceptions in scripts running in isolate worlds as | 7 invoked for uncaught exceptions in scripts running in isolate worlds as |
8 well as for exceptions in the main world.<a href="https://bugs.webkit.org/sh
ow_bug.cgi?id=8519">Bug 8519.</a> | 8 well as for exceptions in the main world.<a href="https://bugs.webkit.org/sh
ow_bug.cgi?id=8519">Bug 8519.</a> |
9 </p> | 9 </p> |
10 <pre id="console"></pre> | 10 <pre id="console"></pre> |
(...skipping 24 matching lines...) Expand all Loading... |
35 function lastUrlComponent(url) { | 35 function lastUrlComponent(url) { |
36 return url ? url.match( /[^\/]+\/?$/ )[0] : url; | 36 return url ? url.match( /[^\/]+\/?$/ )[0] : url; |
37 } | 37 } |
38 | 38 |
39 function log(msg) { | 39 function log(msg) { |
40 var record = document.createElement("div"); | 40 var record = document.createElement("div"); |
41 record.innerHTML = msg; | 41 record.innerHTML = msg; |
42 document.getElementById("console").appendChild(record); | 42 document.getElementById("console").appendChild(record); |
43 } | 43 } |
44 | 44 |
45 window.onerror = function(msg, url, line) { | 45 window.onerror = function(msg, url, line, column, error) { |
46 log(isolatedWorld + " window.onerror: " + msg + " at " + lastUrl
Component(url) + ":" + line, "*"); | 46 log(isolatedWorld + " window.onerror: " + msg + " at " + lastUrl
Component(url) + ", Line: " + line + ", Column: " + column, "*"); |
| 47 if (error) |
| 48 log("Error object present!"); |
| 49 else |
| 50 log("No error object present!"); |
47 return true; | 51 return true; |
48 } | 52 } |
49 | 53 |
50 window.addEventListener("error", function(e) { | 54 window.addEventListener("error", function(e) { |
51 var url = lastUrlComponent(e.filename); | 55 var url = lastUrlComponent(e.filename); |
52 log(isolatedWorld + " error event listener: " + e.message + " at
" + url + ":" + e.lineno, "*"); | 56 log(isolatedWorld + " error event listener: " + e.message + " at
" + url + ":, Line: " + e.lineno, "*"); |
| 57 if (e.error) |
| 58 log("Error object present!"); |
| 59 else |
| 60 log("No error object present!"); |
53 e.preventDefault(); | 61 e.preventDefault(); |
54 }, false); | 62 }, false); |
55 }; | 63 }; |
56 | 64 |
57 if (window.testRunner) { | 65 if (window.testRunner) { |
58 testRunner.dumpAsText(); | 66 testRunner.dumpAsText(); |
59 testRunner.waitUntilDone(); | 67 testRunner.waitUntilDone(); |
60 testRunner.evaluateScriptInIsolatedWorld(1, "(" + errorHandlers + ")
('isolated world'); (" + throwExceptions + ")('isolated world')"); | 68 testRunner.evaluateScriptInIsolatedWorld(1, "(" + errorHandlers + ")
('isolated world'); (" + throwExceptions + ")('isolated world')"); |
61 } | 69 } |
62 | 70 |
63 throwExceptions("main world"); | 71 throwExceptions("main world"); |
64 </script> | 72 </script> |
65 </body> | 73 </body> |
66 </html> | 74 </html> |
OLD | NEW |