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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/form-action-resubmission-window-reload-from-child.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-window-reload-from-child.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/form-action-resubmission-window-reload-from-child.html b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/form-action-resubmission-window-reload-from-child.html
new file mode 100644
index 0000000000000000000000000000000000000000..388b52d716b4e5214daa8d77e7f4d6246508de90
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/form-action-resubmission-window-reload-from-child.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<!--
+ This test documents the current behavior with Content-Security-Policy and
+ form resubmission. It makes a first navigation with a form submission in a
+ new window and then the window reloads itself. This is a form resubmission.
+ The thing is that the window has the "form-action 'none'" policy and the
+ navigation is blocked.
+-->
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<html>
+ <body>
+ <form
+ id="form"
+ method="post"
+ target="popup"
+ action="/security/contentSecurityPolicy/resources/form-action-none-and-reload.html">
+ </form>
+
+ <script>
+ async_test(t => {
+ var popup = window.open("", "popup");
+ window.addEventListener("message", t.step_func(e => {
+ assert_equals(e.source, popup);
+ assert_equals(e.data.effectiveDirective, "form-action");
+ assert_equals(e.data.blockedURI, location.origin + "/security/contentSecurityPolicy/resources/form-action-none-and-reload.html");
+ popup.close();
+ t.done();
+ }));
+ document.getElementById("form").submit();
+ }, "The form resubmission should be blocked by the new window's CSP");
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698