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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/referrer-policy-srcdoc-dynamic-policy.html

Issue 2400443004: Walk up frame tree for srcdoc referrer policies (Closed)
Patch Set: fix dynamic policy test Created 4 years, 2 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/referrer-policy-srcdoc-dynamic-policy.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/referrer-policy-srcdoc-dynamic-policy.html b/third_party/WebKit/LayoutTests/http/tests/security/referrer-policy-srcdoc-dynamic-policy.html
new file mode 100644
index 0000000000000000000000000000000000000000..ed1b7789d8ec12b1993a25840d6144a75e62739a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/referrer-policy-srcdoc-dynamic-policy.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/resources/get-host-info.js"></script>
+ </head>
+ <body>
+ <script>
+ async_test(function () {
+ window.addEventListener("message", this.step_func(function (event) {
+ if (event.data.test == "send-fetch-referrer") {
+ assert_equals(document.location.origin + "/", event.data.referrer);
+ this.done();
+ } else if (event.data.test == "dynamic-referrer-policy") {
+ var meta = document.createElement("meta");
+ meta.name = "referrer";
+ meta.content = "origin";
+ document.head.appendChild(meta);
+ event.source.postMessage({
+ command: "send-fetch-referrer",
+ url: get_host_info().UNAUTHENTICATED_ORIGIN + "/security/resources/echo-referrer-header.php",
+ }, "*");
+ } else {
+ assert_unreached("Unexpected message: " + event.data.test);
+ this.done();
+ }
+ }));
+ }, "srcdoc iframe uses parent's referrer policy, set after iframe was created");
+ </script>
+ <iframe srcdoc="<script src='resources/referrer-policy-srcdoc.php?test=dynamic-referrer-policy'></script>"></iframe>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698