page-with-top-navigating-iframe.html (830B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <script src=/common/get-host-info.sub.js></script> 4 <script src=/resources/testdriver.js></script> 5 <script src=/resources/testdriver-vendor.js></script> 6 <title>Page that embeds an iframe that navigates its top</title> 7 <script> 8 function addIframe() { 9 const iframe = document.createElement('iframe'); 10 const path = new URL("top-navigating-page.html", window.location).pathname; 11 iframe.src = get_host_info().HTTP_NOTSAMESITE_ORIGIN + path; 12 document.body.appendChild(iframe); 13 } 14 15 addEventListener('load', () => { 16 const urlParams = new URLSearchParams(location.search); 17 const parentUserGesture = urlParams.get('parent_user_gesture') === 'true'; 18 if (parentUserGesture) 19 test_driver.bless("Giving parent frame user activation").then(addIframe); 20 else 21 addIframe(); 22 }); 23 </script>