Index: third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade-csp.https.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade-csp.https.html b/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade-csp.https.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1e4ed46597204a3c3015f9230f3e832e9a5add9e |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade-csp.https.html |
@@ -0,0 +1,46 @@ |
+<!DOCTYPE html> |
+<head> |
+<title>Upgrade Insecure Requests: IFrames.</title> |
+<script src="/resources/testharness.js"></script> |
+<script src="/resources/testharnessreport.js"></script> |
+<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> |
+<meta http-equiv="Content-Security-Policy" content="frame-src https:"> |
+</head> |
+<body> |
+<script> |
+async_test(t => { |
+ var i = document.createElement('iframe'); |
+ |
+ // This is a bit of a hack. UPGRADE doesn't upgrade the port number, so we |
+ // specify this non-existent URL ('http' over port 8443). If UPGRADE doesn't |
+ // work, it won't load. |
+ i.src = "http://127.0.0.1:8443/security/resources/post-origin-to-parent.html"; |
+ |
+ 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 frames are upgraded, and do not violate CSP."); |
+ |
+async_test(t => { |
+ var i = document.createElement('iframe'); |
+ |
+ // This is a bit of a hack. UPGRADE doesn't upgrade the port number, so we |
+ // specify this non-existent URL ('http' over port 8443). If UPGRADE doesn't |
+ // work, it won't load. |
+ i.src = "http://example.test:8443/security/resources/post-origin-to-parent.html"; |
+ |
+ 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 frames are upgraded, and do not violate CSP."); |
+ |
+</script> |
+</body> |