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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/form-upgrade.html

Issue 1964303003: UPGRADE: Correctly handle navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forms. Created 4 years, 7 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/upgrade-insecure-requests/form-upgrade.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/form-upgrade.html b/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/form-upgrade.html
new file mode 100644
index 0000000000000000000000000000000000000000..32f1658d3565cda122e2e804f8e7d27455d0e1da
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/form-upgrade.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<head>
+<title>Upgrade Insecure Requests: Form Submission.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<script>
+async_test(t => {
+ var i = document.createElement('iframe');
+ i.srcdoc = "<meta http-equiv='Content-Security-Policy' content='upgrade-insecure-requests'>" +
+ "<form action='http://127.0.0.1:8443/security/resources/post-origin-to-parent.html'></form>" +
+ "<script>document.querySelector('form').submit()</scr" + "ipt>";
+
+ window.addEventListener('message', t.step_func(e => {
+ if (e.source == i.contentWindow) {
+ assert_equals("https://127.0.0.1:8443", e.data.origin);
+ t.done();
+ }
+ }));
+
+ document.body.appendChild(i);
+}, "Same-host form submissions are upgraded.");
+
+async_test(t => {
+ var i = document.createElement('iframe');
+ i.srcdoc = "<meta http-equiv='Content-Security-Policy' content='upgrade-insecure-requests'>" +
+ "<form action='http://example.test:8443/security/resources/post-origin-to-parent.html'></form>" +
+ "<script>document.querySelector('form').submit()</scr" + "ipt>";
+
+ window.addEventListener('message', t.step_func(e => {
+ if (e.source == i.contentWindow) {
+ assert_equals("https://example.test:8443", e.data.origin);
+ t.done();
+ }
+ }));
+
+ document.body.appendChild(i);
+}, "Cross-host form submissions are upgraded.");
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698