| <title>Referrer Policy: iframes correctly inherit the ancestor's referrer</title> |
| <link rel="author" title="Jochen Eisinger" href="mailto:jochen@chromium.org"> |
| <link rel="help" href="https://www.w3.org/TR/referrer-policy/#referrer-policy-delivery-nested"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <!-- Common global functions for referrer-policy tests. --> |
| <script src="/referrer-policy/generic/common.js"></script> |
| <meta name="referrer" content="origin"> |
| <body onload="runTest()"> |
| <h1>Referrer Policy: iframes correctly inherit the ancestor's referrer</h1> |
| var test = async_test("iframes correctly inherit the ancestor's referrer"); |
| window.addEventListener("message", test.step_func((msg) => { |
| assert_equals(msg.data.referrer, document.location.origin + "/"); |
| var iframe = document.createElement("iframe"); |
| iframe.src = "about:blank"; |
| document.body.appendChild(iframe); |
| iframe.contentDocument.write(` |
| <script src = "/referrer-policy/generic/common.js"></` + `script> |
| var urlPath = "/referrer-policy/generic/subresource/xhr.py"; |
| var url = "${location.protocol}//www1.${location.hostname}:${location.port}" + urlPath; |
| parent.postMessage({referrer: msg.referrer}, "*")}); |