partitioned-service-worker-nested-iframe-parent.html (1042B)
1 <!DOCTYPE html> 2 <title>Service Worker: Middle nested iframe for partitioned service workers</title> 3 <script src="./test-helpers.sub.js"></script> 4 <script src="/common/get-host-info.sub.js"></script> 5 <script src="./partitioned-utils.js"></script> 6 7 <body> 8 Middle of the nested iframes (3p ancestor or B in A1-B-A2). 9 <script> 10 11 async function onLoad() { 12 // The innermost iframe will recieve a message from the 13 // ServiceWorker and pass it to this iframe. We need to 14 // then pass that message to the main frame to complete 15 // the test. 16 self.addEventListener('message', evt => { 17 window.parent.postMessage(evt.data, '*'); 18 }); 19 20 // Embed the innermost iframe and set-up the service worker there. 21 const innermost_iframe_url = new URL('./partitioned-service-worker-nested-iframe-child.html', 22 get_host_info().HTTPS_ORIGIN + self.location.pathname); 23 var frame = document.createElement('iframe'); 24 frame.src = innermost_iframe_url; 25 document.body.appendChild(frame); 26 } 27 28 self.addEventListener('load', onLoad); 29 </script> 30 </body>