link-rel-prefetch.html (1031B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Referrer policies for resources loaded via link rel prefetch</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <!-- Common global functions for referrer-policy tests. --> 8 <script src="/common/security-features/resources/common.sub.js"></script> 9 <meta name="referrer" content="origin"> 10 <link rel="prefetch" href="/common/security-features/subresource/image.py"> 11 </head> 12 <body> 13 <p>Check that resources loaded via link rel prefetch use the referrer 14 and referrer policy from the document.</p> 15 16 <script> 17 var img_url = "/common/security-features/subresource/image.py"; 18 promise_test((t) => timeoutPromise(t, 1000) 19 .then(() => requestViaImage(img_url, null)) 20 .then(message => { 21 assert_equals(message.headers.referer, document.location.origin + "/"); 22 }), 23 "Prefetched image."); 24 </script> 25 26 <div id="log"></div> 27 </body> 28 </html>