longtask-in-parentiframe.html (1308B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>LongTask Timing: long task in nested child iframe</title> 4 <body> 5 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 <script> 10 const t = async_test(t => { 11 assert_implements(window.PerformanceLongTaskTiming, 'Longtasks are not supported.'); 12 window.addEventListener('message', t.step_func(e => { 13 assert_equals(e.data['entryType'], 'longtask'); 14 assert_equals(e.data['frame-attribution'], 'same-origin-ancestor'); 15 assert_equals(e.data['task-attribution'], 'unknown'); 16 assert_equals(e.data['containerType'], 'window'); 17 assert_equals(e.data['containerId'], ''); 18 assert_equals(e.data['containerName'], ''); 19 assert_equals(e.data['containerSrc'], ''); 20 t.done(); 21 })); 22 }, 'Performance longtask entries in parent are observable in child iframe.'); 23 24 const iframe = document.createElement('iframe'); 25 iframe.id = 'child-iframe-id'; 26 iframe.name = 'child-iframe-name'; 27 document.body.appendChild(iframe); 28 iframe.src = 'resources/subframe-observing-longtask.html'; 29 iframe.onload = () => { 30 t.step_timeout( () => { 31 const begin = window.performance.now(); 32 while (window.performance.now() < begin + 60); 33 }, 50); 34 }; 35 </script> 36 37 </body>