iframe-inheritance-srcdoc-child.html (1472B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Referrer Policy: iframes srdoc child correctly inherit the ancestor's referrer policy</title> 5 <link rel="help" href="https://www.w3.org/TR/referrer-policy/#referrer-policy-delivery-nested"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/common/get-host-info.sub.js"></script> 9 <script src="resources/make-html-script.js"></script> 10 <meta name="referrer" content="origin"> 11 </head> 12 <body onload="runTest()"> 13 <h1>Referrer Policy: iframes srcdoc child correctly inherit the ancestor's referrer policy</h1> 14 <script> 15 var test = async_test("iframes srcdoc child correctly inherit the ancestor's referrer policy"); 16 window.addEventListener("message", test.step_func_done(msg => { 17 assert_equals(msg.data.referrer, self.origin + "/"); 18 })); 19 20 function runTest() { 21 var iframe = document.createElement("iframe"); 22 iframe.srcdoc = `<body><h1>Outer iframe</h1></body>`; 23 iframe.onload = test.step_func(() => { 24 iframe.onload = null; 25 var iframeChild = iframe.contentDocument.createElement("iframe"); 26 iframeChild.srcdoc = createScriptString(get_host_info().REMOTE_ORIGIN); 27 iframe.contentDocument.body.appendChild(iframeChild); 28 }); 29 document.body.appendChild(iframe); 30 } 31 </script> 32 <div id="log"></div> 33 </body> 34 </html>