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

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

Issue 19962008: Rewrite the 'window.onerror' tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tests. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/events/window-onerror-isolatedworld-01.html
diff --git a/LayoutTests/fast/events/window-onerror-isolatedworld-01.html b/LayoutTests/fast/events/window-onerror-isolatedworld-01.html
new file mode 100644
index 0000000000000000000000000000000000000000..48b1b81e93cbda09c685d2181e58d717dfe78bef
--- /dev/null
+++ b/LayoutTests/fast/events/window-onerror-isolatedworld-01.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="resources/onerror-test.js"></script>
+</head>
+<body>
+ <p>Test that window.onerror and "error" event listeners from main world are
+ invoked for uncaught exceptions in scripts running in isolate worlds as
+ well as for exceptions in the main world.<a href="https://bugs.webkit.org/show_bug.cgi?id=8519">Bug 8519.</a>
+ </p>
+ <script>
+ var handledErrors = 0;
+ function callback() {
+ handledErrors++;
+ if (handledErrors === 12 && window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ DumpOnErrorArgumentValuesAndReturn(true, callback);
+ DumpErrorEventAndPreventDefault(callback);
+
+ var exceptions = function(worldType)
+ {
+ window.addEventListener("load", function(e) {
+ // Do the following call from load listener to make sure error in the setTimeout callback always happens after the error in this listener.
+ setTimeout(function() {
+ throw new Error("Error in " + worldType + " world setTimeout callback.");
+ }, 0);
+ throw new Error("Error in " + worldType + " world load handler.");
+ }, false);
+
+ throw new Error("Error in " + worldType + " world inline script.");
+ }
+
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ testRunner.evaluateScriptInIsolatedWorld(1, "(" + exceptions + ")('isolated')");
+ }
+
+ exceptions("main");
+
+ </script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698