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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/form-action-resubmission-main-page.html

Issue 2737343004: CSP: A new set of test with form resubmission. (Closed)
Patch Set: Use testharness for main page form resubmission. 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/1.1/form-action-resubmission-main-page.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/form-action-resubmission-main-page.html b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/form-action-resubmission-main-page.html
new file mode 100644
index 0000000000000000000000000000000000000000..8b14e865c2075ff8be1d05e982e9761aac731500
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/form-action-resubmission-main-page.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<!--
+ This test documents the current behavior with Content-Security-Policy and
+ form resubmission. It makes a first navigation with a form submission, then
+ the next page reloads itself. This is a form resubmission. The thing is that
+ the second page has set the "form-action 'none'" policy. The reload is
+ blocked.
+-->
+<html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ async_test(t => {
+ var w;
+ window.addEventListener("message", t.step_func_done(e => {
+ w.close();
+ assert_equals(e.data.effectiveDirective, "form-action");
+ assert_equals(e.data.documentURI, "http://127.0.0.1:8000/security/contentSecurityPolicy/resources/form-action-resubmission-main-page-callee.html");
+ assert_equals(e.data.referrer, "http://127.0.0.1:8000/security/contentSecurityPolicy/resources/form-action-resubmission-main-page-caller.html");
+ }));
+ w = window.open("/security/contentSecurityPolicy/resources/form-action-resubmission-main-page-caller.html");
+ }, "A form resubmission in the main frame should be blocked");
+</script>
+</head>
+</html>

Powered by Google App Engine
This is Rietveld 408576698