no-entries-for-cross-origin-css-fetched.sub.html (1842B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Make sure that resources fetched by cross origin CSS are not in the timeline.</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/common/get-host-info.sub.js"></script> 7 <body> 8 <script> 9 const host = get_host_info(); 10 11 const link = document.createElement("LINK"); 12 link.rel = "stylesheet"; 13 link.id = "cross_origin_style"; 14 15 /* 16 This stylesheet is fetched from one of: 17 //www1.web–platform.test:64941/resource-timing/resources/nested.css 18 //127.0.0.1:64941/resource-timing/resources/nested.css 19 */ 20 link.href = "//" + host.REMOTE_HOST + ":{{ports[http][1]}}{{location[path]}}/../resources/nested.css" 21 document.currentScript.parentNode.insertBefore(link, document.currentScript); 22 </script> 23 <script> 24 const t = async_test("Make sure that resources fetched by cross origin CSS are not in the timeline."); 25 window.addEventListener("load", function() { 26 // A timeout is needed as entries are not guaranteed to be in the timeline before onload triggers. 27 t.step_timeout(function() { 28 const url = (new URL(document.getElementById("cross_origin_style").href)); 29 const prefix = url.protocol + "//" + url.host; 30 assert_equals(performance.getEntriesByName(prefix + "/resource-timing/resources/resource_timing_test0.css?id=n1").length, 0, "Import should not be in timeline"); 31 assert_equals(performance.getEntriesByName(prefix + "/fonts/Ahem.ttf?id=n1").length, 0, "Font should not be in timeline"); 32 assert_equals(performance.getEntriesByName(prefix + "/resource-timing/resources/blue.png?id=n1").length, 0, "Image should not be in timeline"); 33 t.done(); 34 }, 200); 35 }); 36 </script> 37 <ol>Some content</ol> 38 </body>