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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/upgrade-insecure-requests-reporting.https.html

Issue 2910573002: Implement upgrade-insecure-requests in browser for frame requests (Closed)
Patch Set: rebase Created 3 years, 6 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/external/wpt/content-security-policy/securitypolicyviolation/upgrade-insecure-requests-reporting.https.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/upgrade-insecure-requests-reporting.https.html b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/upgrade-insecure-requests-reporting.https.html
index 5a0bc7c8e7aa2e2c952dcdc0bd2f083934fc55ee..692db02b6fc5392b08cfcfeb98b88553cb6f72bd 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/upgrade-insecure-requests-reporting.https.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/securitypolicyviolation/upgrade-insecure-requests-reporting.https.html
@@ -56,5 +56,37 @@
i.src = url;
document.body.appendChild(i);
}, "Upgraded iframe is reported");
+
+ async_test(t => {
+ // Load an HTTPS iframe, then navigate it to an HTTP URL and check that the HTTP URL is both upgraded and reported.
+ var url = generateURL(Host.SAME_ORIGIN, Protocol.SECURE, ResourceType.FRAME).url;
+ var navigate_to = generateURL(Host.CROSS_ORIGIN, Protocol.INSECURE, ResourceType.FRAME).url;
+ var upgraded = new URL(navigate_to);
+ upgraded.protocol = "https";
+
+ var i = document.createElement('iframe');
+ var loaded = false;
+ var reported = false;
+
+ window.addEventListener("message", t.step_func(e => {
+ if (e.source == i.contentWindow) {
+ if (e.data == (new URL(url)).origin) {
+ waitForViolation(window, "frame-src")
+ .then(t.step_func(e => {
+ reported = true;
+ if (loaded)
+ t.done();
+ }));
+ i.contentWindow.location.href = navigate_to;
+ } else if (e.data == (new URL(upgraded)).origin) {
+ loaded = true;
+ if (reported)
+ t.done();
+ }
+ }
+ }));
+ i.src = url;
+ document.body.appendChild(i);
+ }, "Navigated iframe is upgraded and reported");
</script>
</html>

Powered by Google App Engine
This is Rietveld 408576698