OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="resources/onerror-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <p>Test that window.onerror and "error" event listeners from main world are |
| 8 invoked for uncaught exceptions in scripts running in isolate worlds as |
| 9 well as for exceptions in the main world.<a href="https://bugs.webkit.org/sh
ow_bug.cgi?id=8519">Bug 8519.</a> |
| 10 </p> |
| 11 <script> |
| 12 var handledErrors = 0; |
| 13 function callback() { |
| 14 handledErrors++; |
| 15 if (handledErrors === 12 && window.testRunner) |
| 16 testRunner.notifyDone(); |
| 17 } |
| 18 |
| 19 DumpOnErrorArgumentValuesAndReturn(true, callback); |
| 20 DumpErrorEventAndPreventDefault(callback); |
| 21 |
| 22 var exceptions = function(worldType) |
| 23 { |
| 24 window.addEventListener("load", function(e) { |
| 25 // Do the following call from load listener to make sure error i
n the setTimeout callback always happens after the error in this listener. |
| 26 setTimeout(function() { |
| 27 throw new Error("Error in " + worldType + " world setTimeout
callback."); |
| 28 }, 0); |
| 29 throw new Error("Error in " + worldType + " world load handler."
); |
| 30 }, false); |
| 31 |
| 32 throw new Error("Error in " + worldType + " world inline script."); |
| 33 } |
| 34 |
| 35 if (window.testRunner) { |
| 36 testRunner.dumpAsText(); |
| 37 testRunner.waitUntilDone(); |
| 38 testRunner.evaluateScriptInIsolatedWorld(1, "(" + exceptions + ")('i
solated')"); |
| 39 } |
| 40 |
| 41 exceptions("main"); |
| 42 |
| 43 </script> |
| 44 </body> |
| 45 </html> |
OLD | NEW |