include-frames-subframe.html (1266B)
1 <!DOCTYPE html> 2 3 <head> 4 </head> 5 <!-- 6 This html is embedded as a sub-frame in include-frames-originA-B-A.html, 7 include-frames-originA-B-B.html and include-frames-originA-A-A.html. Once embedded, 8 this would take a url parameter named origin which is the origin of the child frame 9 this html is to load in step 3 listed below. 10 It does, 11 1, waits for load. 12 2, creates a single mark performance entry. 13 3, creates and loads a child frame, and waits for it to load. 14 4. verify entries obtained from this frame. 15 --> 16 17 <body> 18 <script> 19 (async () => { 20 // Wait for load. 21 await new Promise(resolve => window.addEventListener("load", resolve)); 22 23 // Mark. 24 performance.mark("mark_subframe"); 25 26 // Create and load an iframe and wait for load. 27 await new Promise(resolve => { 28 const childFrame = document.createElement('iframe'); 29 30 childFrame.addEventListener('load', async () => { 31 window.parent.postMessage('Load completed', "*"); 32 resolve(); 33 }); 34 35 childFrame.src = (new URL(document.location)).searchParams.get('origin') 36 + '/performance-timeline/resources/child-frame.html'; 37 38 document.body.appendChild(childFrame); 39 } 40 ); 41 })(); 42 </script> 43 </body>