internal-resources-not-counted.html (1585B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <title>Resource Timing should not include internal resources</title> 4 <link rel="author" title="Google" href="http://www.google.com/" /> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/common/get-host-info.sub.js"></script> 8 9 <p>This test validates that image resources which are part of an element's 10 UA-defined interface are not exposed to the performance timeline. This uses an 11 <audio> element as an example of an element with internal resources used 12 for the playback controls, and verifies that resource timing entries are not 13 created. 14 </p> 15 16 <!-- This element will render with internal resources for playback controls --> 17 <audio controls></audio> 18 19 <script> 20 async_test(t => { 21 const observer = new PerformanceObserver(t.step_func_done(events => { 22 events.getEntries().forEach(entry => { 23 assert_true(entry.initiatorType == "script" || entry.initiatorType == "img", 24 "Resources loaded from this test should have initiatorType 'script' or 'img', but \"" + 25 entry.name + "\" has '" + entry.initiatorType + "'."); 26 }); 27 })); 28 29 // Wait for one more resource to load before attaching listener, and then get 30 // buffered entries. 31 const image = document.createElement("img"); 32 image.src = "resources/blue.png"; 33 image.addEventListener("load", t.step_func(ev => { 34 observer.observe({type: "resource", buffered: true}); 35 })); 36 document.body.appendChild(image); 37 38 }, "Resource timing should not include internal resources."); 39 </script>