preconnect-in-early-hints.html (836B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="early-hints-helpers.sub.js"></script> 6 <body> 7 <script> 8 promise_test(async (t) => { 9 const params = new URLSearchParams(window.location.search); 10 const resource_url = params.get("resource-url"); 11 await fetchScript(resource_url); 12 13 // Check the resource's connect timing. 14 const entries = performance.getEntriesByName(resource_url); 15 assert_equals(entries.length, 1); 16 const connect_start = entries[0].connectStart; 17 const connect_end = entries[0].connectEnd; 18 assert_equals(connect_start, connect_end, 19 "Connection establishment should not take time for a resource from a preconnected origin."); 20 }, "Preconnect in early hints."); 21 </script> 22 </body>