partitioned-parent.html (969B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"/> 3 <meta name="referrer" content="origin"> 4 <script> 5 async function onLoad() { 6 // Step 6 and Nested Step 9: 7 // wpt/web-locks/partitioned-web-locks.tentative.https.html 8 self.addEventListener('message', evt => { 9 if (self.opener) 10 self.opener.postMessage(evt.data, '*'); 11 else 12 self.top.postMessage(evt.data, '*'); 13 }, { once: true }); 14 15 // Step 3 and Nested Step 3: 16 // wpt/web-locks/partitioned-web-locks.tentative.https.html 17 const params = new URLSearchParams(self.location.search); 18 const frame = document.createElement('iframe'); 19 frame.src = params.get('target'); 20 document.body.appendChild(frame); 21 22 // Step 4 and Nested Step 4: 23 // wpt/web-locks/partitioned-web-locks.tentative.https.html 24 frame.addEventListener('load', function(){ 25 frame.contentWindow.postMessage({op: 'request', 26 name: 'testLock', ifAvailable: true}, '*'); 27 }); 28 } 29 self.addEventListener('load', onLoad); 30 </script>