partitioned-cookies-cross-site-window.html (1295B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"/> 3 <meta name="timeout" content="long"> 4 <title>Cross-site window</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/common/get-host-info.sub.js"></script> 7 <script src="/cookies/resources/cookie-helper.sub.js"></script> 8 <script src="/cookies/partitioned-cookies/resources/test-helpers.js"></script> 9 10 <body> 11 <script> 12 13 let origin; 14 15 // Test that parent window passed its origin in the URL parameters correctly. 16 test(() => { 17 assert_true(window.location.search.startsWith("?origin=")); 18 origin = decodeURIComponent(window.location.search.slice( 19 window.location.search.indexOf("?origin=") + 8)); 20 }, "Cross-site window opened correctly"); 21 22 // Test that the request to the parent window's origin does not contain the 23 // partitioned cookie. 24 testHttpPartitionedCookies({ 25 origin, 26 cookieNames: getCookieNames(), 27 expectsCookie: false, 28 }); 29 30 // Create a cross-site <iframe> which embeds the cookies' origin into this 31 // page. 32 const iframe = document.createElement("iframe"); 33 const url = new URL( 34 "/cookies/partitioned-cookies/resources/" + 35 "partitioned-cookies-cross-site-embed.html", 36 origin); 37 iframe.src = String(url); 38 document.body.appendChild(iframe); 39 40 fetch_tests_from_window(iframe.contentWindow); 41 42 </script> 43 </body>