Index: LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js |
diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js b/LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cbb985d033f6b27290d0240bd614fed30bf4b5f7 |
--- /dev/null |
+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js |
@@ -0,0 +1,17 @@ |
+async_test(function(t) { |
+ var xhr = new XMLHttpRequest(); |
+ xhr.onload = function () { |
+ t.step(function () { assert_true(xhr.status === 404); t.done(); }); |
+ }; |
+ // Send a request that returns 200 if and only if CSP header is present. |
+ xhr.open( |
+ "GET", |
+ "http://127.0.0.1:8000/security/contentSecurityPolicy/resources/test-csp-header.pl", |
+ true |
+ ); |
+ xhr.send(); |
+}, 'CSP header is not sent on resource requests for which there is no policy.'); |
+ |
+test(function() { |
+ assert_true(typeof(script_loaded) !== "undefined"); |
+}, 'CSP header is sent on resource requests for which there is a policy.'); |