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

Unified Diff: LayoutTests/http/tests/security/script-onerror-crossorigin-cors.html

Issue 19596004: Allow sites to enable 'window.onerror' handlers for cross-domain scripts. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 7 years, 4 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/http/tests/security/script-onerror-crossorigin-cors.html
diff --git a/LayoutTests/http/tests/security/script-onerror-crossorigin-cors.html b/LayoutTests/http/tests/security/script-onerror-crossorigin-cors.html
new file mode 100644
index 0000000000000000000000000000000000000000..deeed1c379c605d052a4c6353c815d13e5b18a6c
--- /dev/null
+++ b/LayoutTests/http/tests/security/script-onerror-crossorigin-cors.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<head>
+</head>
+<body>
+ <script src="../../js-test-resources/js-test-pre.js"></script>
+ <script>
+ window.jsTestIsAsync = true;
+ description("The test passes if 'window.onerror' gets unsanitized information about an exception thrown in a script loaded with a 'crossorigin' attribute, and delivered with valid CORS headers.");
+
+ window.onerror = function(msg, url, line, column, error) {
+ window.msg = msg;
+ window.url = url;
+ window.line = line;
+ window.column = column;
+ window.errorObject = error;
+ shouldBeTrue("/SomeError/.test(msg)");
+ shouldBeEqualToString("url", "http://localhost:8000/security/resources/cors-script.php?fail=true&cors=true");
+ shouldBe("line", "1");
+ shouldBe("column", "0");
+ shouldNotBe("window.errorObject", "null");
+ finishJSTest();
+ }
+ </script>
+ <script crossorigin="anonymous" src="http://localhost:8000/security/resources/cors-script.php?fail=true&cors=true"></script>
+ <script src="../../js-test-resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698