OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Referrer Policy: Sandboxed iframes with opaque origins don't send ref
errers</title> |
| 5 <link rel="author" title="Jochen Eisinger" href="mailto:jochen@chromium.org"
> |
| 6 <link rel="help" href="https://www.w3.org/TR/referrer-policy/#determine-requ
ests-referrer"> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <!-- Common global functions for referrer-policy tests. --> |
| 10 <script src="/referrer-policy/generic/common.js"></script> |
| 11 </head> |
| 12 <body> |
| 13 <h1>Referrer Policy: A document with an opaque origin doesn't send referrers
</h1> |
| 14 <script> |
| 15 function testSandboxedIframe(description, sandboxAttributes, expectedRefer
rer) { |
| 16 var test = async_test(description); |
| 17 window.addEventListener("message", test.step_func((msg) => { |
| 18 if (msg.data.description === description) { |
| 19 assert_equals(msg.data.referrer, expectedReferrer); |
| 20 test.done(); |
| 21 } |
| 22 })); |
| 23 |
| 24 var iframe = document.createElement("iframe"); |
| 25 iframe.sandbox = sandboxAttributes; |
| 26 iframe.srcdoc = ` |
| 27 <meta name = "referrer" content = "always"> |
| 28 <script src = "/referrer-policy/generic/common.js"></` + `script> |
| 29 <script> |
| 30 var urlPath = "/referrer-policy/generic/subresource/xhr.py"; |
| 31 var url = "${location.protocol}//www1.${location.hostname}:${locat
ion.port}" + urlPath; |
| 32 queryXhr(url, (msg) => { |
| 33 parent.postMessage({referrer: msg.referrer, description: "${de
scription}"}, "*")}); |
| 34 </` + "script>"; |
| 35 document.body.appendChild(iframe); |
| 36 } |
| 37 |
| 38 testSandboxedIframe("Sandboxed iframe with opaque origin doesn't send refe
rrers.", "allow-scripts", undefined); |
| 39 testSandboxedIframe("Sandboxed iframe with tuple origin sends referrers.",
"allow-same-origin allow-scripts", document.location.href); |
| 40 </script> |
| 41 |
| 42 <div id="log"></div> |
| 43 </body> |
| 44 </html> |
OLD | NEW |