processing-instruction.html (1794B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS integration - image from external stylesheet inserted via a ProcessingInstruction</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="never"> 11 </head> 12 <body> 13 <p>Check that resources from external stylesheets (referenced from a 14 ProcessingInstruction) are loaded with the referrer and referrer policy 15 from the external stylesheet.</p> 16 17 <div class="styled"></div> 18 19 <script> 20 promise_test(function(css_test) { 21 var id = token(); 22 var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; 23 var css_url = url_prefix + "/common/security-features/subresource/stylesheet.py?id=" + id; 24 var img_url = url_prefix + "/common/security-features/subresource/image.py" + 25 "?id=" + id + "&report-headers"; 26 27 var processingInstruction = document.createProcessingInstruction("xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\""); 28 document.insertBefore(processingInstruction, document.firstChild); 29 return timeoutPromise(css_test, 1000) 30 .then(() => requestViaXhr(img_url)) 31 .then(function(message) { 32 assert_own_property(message, "headers"); 33 assert_own_property(message, "referrer"); 34 assert_equals(message.referrer, css_url); 35 }); 36 }, "Image from external stylesheet (from ProcessingInstruction)."); 37 </script> 38 39 <div id="log"></div> 40 </body> 41 </html>