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