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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-malformed-meta.html

Issue 2456013002: CSP: 'connect-src' should not cause exceptions. (Closed)
Patch Set: Ugh. Created 3 years, 9 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: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-malformed-meta.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-malformed-meta.html b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-malformed-meta.html
index 90b125dc42fb87cbac090bd244d0f1134edf307a..e821eff7b0e44f62b54350589ce344d4f05df2c9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-malformed-meta.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-malformed-meta.html
@@ -3,8 +3,10 @@
<head>
<meta http-equiv="Content-Security-Policy" content="connect-src http://localhost:8000"<script>
<script>
-if (window.testRunner)
+if (window.testRunner) {
testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
</script>
</head>
<body>
@@ -15,13 +17,11 @@ function log(msg)
document.getElementById("console").appendChild(document.createTextNode(msg + "\n"));
}
-try {
- var xhr = new XMLHttpRequest;
- xhr.open("GET", "http://127.0.0.1:8000/xmlhttprequest/resources/get.txt", true);
- log("Fail");
-} catch(e) {
- log("Pass");
-}
+var xhr = new XMLHttpRequest;
+xhr.open("GET", "http://127.0.0.1:8000/xmlhttprequest/resources/get.txt", true);
+xhr.onerror = _ => { log("Pass"); testRunner.notifyDone(); }
+xhr.onload = _ => { log("Fail"); testRunner.notifyDone(); }
+xhr.send();
</script>
<p>This test passes if the malformed meta tag doesn't cause a crash and the resource is blocked.</p>

Powered by Google App Engine
This is Rietveld 408576698