iframe-with-download.html (1169B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Test the sequence of events when reporting iframe timing.</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="resources/resource-loaders.js"></script> 7 <body> 8 <script> 9 promise_test(async t => { 10 const href = new URL('resources/download.asis', location.href); 11 const iframe = document.createElement('iframe'); 12 iframe.src = href; 13 const errored = new Promise(resolve => iframe.addEventListener('error', resolve)); 14 const loaded = new Promise(resolve => iframe.addEventListener('load', resolve)); 15 document.body.appendChild(iframe); 16 const timeout = 2000; 17 t.add_cleanup(() => iframe.remove()); 18 const expired = new Promise(resolve => t.step_timeout(resolve, timeout)); 19 await Promise.any([loaded, expired, errored]); 20 const entries = performance.getEntriesByType('resource').filter(({name}) => name.startsWith(href)); 21 assert_equals(entries.length, 0); 22 }, 'Iframes should not report resource timing for non-handled mime-types (downloads)'); 23 </script> 24 </body>