5 window
.jsTestIsAsync
= true;
6 window
.isOnErrorTest
= true;
8 <script src=
"../../resources/js-test.js"></script>
9 <script src=
"resources/onerror-test.js"></script>
13 description('Test that window.onerror and "error" event listeners from main world are not invoked for uncaught exceptions in scripts running in isolate worlds, but only for exceptions in the main world.');
15 var onerrorsHandled
= 0;
16 function onErrorCallback(errorsHandled
) {
18 if (onerrorsHandled
> 3)
19 testFailed("Only main-world exceptions should be caught by onerror handlers.");
21 // FIXME: This should be 6 once we correctly handle 'error' event dispatch for worlds: crbug.com/225513
22 if (errorsHandled
=== 9)
26 var errorEventsHandled
= 0;
27 function errorEventCallback(errorsHandled
) {
29 if (errorEventsHandled
> 3) {
30 // FIXME: This currently fails. We need to correctly handle 'error' event dispatch for worlds: crbug.com/225513
31 testFailed("Only main-world exceptions should be caught by ErrorEvent listeners.");
34 // FIXME: This should be 6 once we correctly handle 'error' event dispatch for worlds: crbug.com/225513
35 if (errorsHandled
=== 9)
39 dumpOnErrorArgumentValuesAndReturn(true, onErrorCallback
);
40 dumpErrorEventAndPreventDefault(errorEventCallback
);
42 var exceptions = function(worldType
)
44 window
.addEventListener("load", function(e
) {
45 // Do the following call from load listener to make sure error in the setTimeout callback always happens after the error in this listener.
46 setTimeout(function() {
47 throw new Error("Error in " + worldType
+ " world setTimeout callback.");
49 throw new Error("Error in " + worldType
+ " world load handler.");
52 throw new Error("Error in " + worldType
+ " world inline script.");
55 if (window
.testRunner
)
56 testRunner
.evaluateScriptInIsolatedWorld(1, "(" + exceptions
+ ")('isolated')");