Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: LayoutTests/fast/events/window-onerror-isolatedworld-01.html

Issue 21071003: Trigger `window.onerror` only for exceptions thrown in the same world. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: feedback Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/events/window-onerror-isolatedworld-01-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script> 4 <script>
5 window.jsTestIsAsync = true; 5 window.jsTestIsAsync = true;
6 window.isOnErrorTest = true; 6 window.isOnErrorTest = true;
7 </script> 7 </script>
8 <script src="../js/resources/js-test-pre.js"></script> 8 <script src="../js/resources/js-test-pre.js"></script>
9 <script src="resources/onerror-test.js"></script> 9 <script src="resources/onerror-test.js"></script>
10 </head> 10 </head>
11 <body> 11 <body>
12 <script> 12 <script>
13 description('Test that window.onerror and "error" event listeners from m ain world are invoked for uncaught exceptions in scripts running in isolate worl ds as well as for exceptions in the main world.'); 13 description('Test that window.onerror and "error" event listeners from m ain world are not invoked for uncaught exceptions in scripts running in isolate worlds, but only for exceptions in the main world.');
14 14
15 function callback(errorsHandled) { 15 var onerrorsHandled = 0;
16 if (errorsHandled === 12) 16 function onErrorCallback(errorsHandled) {
17 onerrorsHandled++;
18 if (onerrorsHandled > 3)
19 testFailed("Only main-world exceptions should be caught by onerr or handlers.");
20
21 // FIXME: This should be 6 once we correctly handle 'error' event di spatch for worlds: crbug.com/225513
22 if (errorsHandled === 9)
17 finishJSTest(); 23 finishJSTest();
18 } 24 }
19 25
20 dumpOnErrorArgumentValuesAndReturn(true, callback); 26 var errorEventsHandled = 0;
21 dumpErrorEventAndPreventDefault(callback); 27 function errorEventCallback(errorsHandled) {
28 errorEventsHandled++;
29 if (errorEventsHandled > 3) {
30 // FIXME: This currently fails. We need to correctly handle 'err or' event dispatch for worlds: crbug.com/225513
31 testFailed("Only main-world exceptions should be caught by Error Event listeners.");
32 }
33
34 // FIXME: This should be 6 once we correctly handle 'error' event di spatch for worlds: crbug.com/225513
35 if (errorsHandled === 9)
36 finishJSTest();
37 }
38
39 dumpOnErrorArgumentValuesAndReturn(true, onErrorCallback);
40 dumpErrorEventAndPreventDefault(errorEventCallback);
22 41
23 var exceptions = function(worldType) 42 var exceptions = function(worldType)
24 { 43 {
25 window.addEventListener("load", function(e) { 44 window.addEventListener("load", function(e) {
26 // Do the following call from load listener to make sure error i n the setTimeout callback always happens after the error in this listener. 45 // Do the following call from load listener to make sure error i n the setTimeout callback always happens after the error in this listener.
27 setTimeout(function() { 46 setTimeout(function() {
28 throw new Error("Error in " + worldType + " world setTimeout callback."); 47 throw new Error("Error in " + worldType + " world setTimeout callback.");
29 }, 0); 48 }, 0);
30 throw new Error("Error in " + worldType + " world load handler." ); 49 throw new Error("Error in " + worldType + " world load handler." );
31 }, false); 50 }, false);
32 51
33 throw new Error("Error in " + worldType + " world inline script."); 52 throw new Error("Error in " + worldType + " world inline script.");
34 } 53 }
35 54
36 if (window.testRunner) 55 if (window.testRunner)
37 testRunner.evaluateScriptInIsolatedWorld(1, "(" + exceptions + ")('i solated')"); 56 testRunner.evaluateScriptInIsolatedWorld(1, "(" + exceptions + ")('i solated')");
38 57
39 exceptions("main"); 58 exceptions("main");
40 59
41 </script> 60 </script>
42 <script src="../js/resources/js-test-post.js"></script> 61 <script src="../js/resources/js-test-post.js"></script>
43 </body> 62 </body>
44 </html> 63 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/window-onerror-isolatedworld-01-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698