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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/referrerPolicyHeader/referrer-policy-cross-origin-redirect.php

Issue 2151693009: Preserve referrer across CORS-enabled redirects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/referrerPolicyHeader/resources/redirect-to.php » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/security/referrerPolicyHeader/referrer-policy-cross-origin-redirect.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/referrerPolicyHeader/referrer-policy-cross-origin-redirect.php b/third_party/WebKit/LayoutTests/http/tests/security/referrerPolicyHeader/referrer-policy-cross-origin-redirect.php
new file mode 100644
index 0000000000000000000000000000000000000000..fb55168eb423339fbbec19a276b88a4964810e5a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/referrerPolicyHeader/referrer-policy-cross-origin-redirect.php
@@ -0,0 +1,27 @@
+<?php
+header("Referrer-Policy: origin-when-cross-origin");
+?>
+<!DOCTYPE html>
+<head>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/resources/get-host-info.js"></script>
+</head>
+<body>
+</body>
+<script>
+ // Tests that once a referrer has been stripped while following one leg of a redirected request, the referrer doesn't get reconstructed on subsequent legs.
+ async_test(function () {
+ var test = this;
+ fetch(get_host_info().AUTHENTICATED_ORIGIN + "/security/referrerPolicyHeader/resources/redirect-to.php?location=" + document.location.origin + "/security/referrerPolicyHeader/resources/referrer-and-host.php").then(test.step_func(function(response) {
+ response.json().then(test.step_func(function (result) {
+ // Sanity check that the request redirect back to the same origin as this page.
+ assert_equals(result.host, document.location.host);
+ // The origin should have been stripped because the initial leg of the request was cross-origin.
+ assert_equals(document.location.origin + "/", result.referrer);
+ test.done();
+ }));
+ }));
+ });
+</script>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/referrerPolicyHeader/resources/redirect-to.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698