diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/referrer-policy/generic/inheritance/iframe-inheritance-srcdoc.html')
-rw-r--r-- | tests/wpt/web-platform-tests/referrer-policy/generic/inheritance/iframe-inheritance-srcdoc.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/inheritance/iframe-inheritance-srcdoc.html b/tests/wpt/web-platform-tests/referrer-policy/generic/inheritance/iframe-inheritance-srcdoc.html new file mode 100644 index 00000000000..34ea0045b48 --- /dev/null +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/inheritance/iframe-inheritance-srcdoc.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <title>Referrer Policy: iframes srdoc correctly inherit the ancestor's referrer policy</title> + <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="/common/security-features/resources/common.js"></script> + <script src="/referrer-policy/generic/referrer-policy-test-case.sub.js"></script> + <meta name="referrer" content="origin"> + </head> + <body onload="runTest()"> + <h1>Referrer Policy: iframes srcdoc correctly inherit the ancestor's referrer policy</h1> + <script> + var test = async_test("iframes srcdoc correctly inherit the ancestor's referrer policy"); + window.addEventListener("message", test.step_func((msg) => { + assert_equals(msg.data.referrer, document.location.origin + "/"); + test.done(); + })); + + function runTest() { + var iframe = document.createElement("iframe"); + iframe.srcdoc = + `<script src = "/common/security-features/resources/common.js"></` + `script> + <script src = "/referrer-policy/generic/referrer-policy-test-case.sub.js"></` + `script> + <script> + var urlPath = "/common/security-features/subresource/xhr.py"; + var url = "${location.protocol}//www1.${location.hostname}:${location.port}" + urlPath; + requestViaXhr(url).then((msg) => { + parent.postMessage({referrer: msg.referrer}, "*")}) + .catch((e) => { + parent.postMessage({referrer: "FAILURE"}, "*"); + }); + </` + "script>"; + + document.body.appendChild(iframe); + } + </script> + <div id="log"></div> + </body> +</html> |