external-import-stylesheet.html (2063B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS integration - Font from imported stylesheet (external)</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 imported stylesheets (loaded from external 14 stylesheets) are loaded with the referrer and referrer policy from the 15 external stylesheet.</p> 16 17 <div class="styled"></div> 18 19 <script> 20 promise_test(function(css_test) { 21 let id = token(); 22 let css_url = location.protocol + "//www1." + location.hostname + ":" + 23 location.port + 24 "/common/security-features/subresource/stylesheet.py?id=" + id + 25 "&import-rule" + "&type=font"; 26 let url_prefix = location.protocol + "//" + location.hostname + ":" + location.port; 27 let css_referrer = url_prefix + 28 "/common/security-features/subresource/stylesheet.py?id=" + id + "&type=font"; 29 let font_url = url_prefix + "/common/security-features/subresource/font.py" + 30 "?id=" + id + "&report-headers" + "&type=font"; 31 32 return new Promise(resolve => { 33 let link = document.createElement("link"); 34 link.href = css_url; 35 link.rel = "stylesheet"; 36 link.onload = resolve; 37 document.head.appendChild(link); 38 }) 39 .then(() => timeoutPromise(css_test, 1000)) 40 .then(() => requestViaXhr(font_url)) 41 .then(function(message) { 42 assert_own_property(message, "headers"); 43 assert_own_property(message, "referrer"); 44 assert_equals(message.referrer, css_referrer); 45 }); 46 }, "Font from imported stylesheet (external)."); 47 </script> 48 49 <div id="log"></div> 50 </body> 51 </html>