internal-stylesheet.html (1580B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS integration - image from internal stylesheet</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/common/utils.js"></script> 8 <!-- Common global functions for referrer-policy tests. --> 9 <script src="/common/security-features/resources/common.sub.js"></script> 10 <meta name="referrer" content="origin"> 11 </head> 12 <body> 13 <p>Check that resources from internal stylesheets are loaded with 14 the referrer and referrer policy from the document.</p> 15 16 <div class="styled"></div> 17 18 <script> 19 promise_test(function(css_test) { 20 var id = token(); 21 var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/common/security-features/subresource/image.py" + "?id=" + id; 22 var img_url = css_url + "&report-headers"; 23 24 var style = document.createElement("style"); 25 style.type = 'text/css'; 26 style.appendChild(document.createTextNode("div.styled::before { content:url(" + css_url + ")}")); 27 document.head.appendChild(style); 28 return timeoutPromise(css_test, 1000) 29 .then(() => requestViaXhr(img_url)) 30 .then(function(message) { 31 assert_own_property(message, "headers"); 32 assert_own_property(message, "referrer"); 33 assert_equals(message.referrer, location.origin + "/"); 34 }); 35 }, "Image from internal stylesheet."); 36 </script> 37 38 <div id="log"></div> 39 </body> 40 </html>