unique-cookie-partition-inner.https.html (1258B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="utils.js"></script> 4 <title>Fenced frame accessing cookies</title> 5 6 <body> 7 <script> 8 async function init() { 9 // This file is meant to run in a <fencedframe>. It sets up multiple frames 10 // in the following arrangements: 11 // 1.) A top-level fenced frame 12 // 2.) An iframe within a fenced frame 13 // 3.) A nested fenced frame 14 15 // Set cookies in the root fenced frame via document and cookieStore APIs. 16 const [cookie_value_key, test_type] = parseKeylist(); 17 document.cookie = 'C=fenced; SameSite=Lax'; 18 document.cookie = 'D=fenced; SameSite=None; Secure'; 19 await cookieStore.set('E', 'fenced'); 20 21 const cookie_access_url = generateURL("cookie-access.https.html", 22 [cookie_value_key]); 23 24 switch (test_type) { 25 case "top-level fenced frame": 26 const cookie_value = document.cookie; 27 writeValueToServer(cookie_value_key, cookie_value); 28 break; 29 case "nested iframe": 30 const iframe = document.createElement('iframe'); 31 document.body.append(iframe); 32 iframe.src = cookie_access_url; 33 break; 34 case "nested fenced frame": 35 const ff = attachFencedFrame(cookie_access_url); 36 break; 37 } 38 } 39 40 init(); 41 </script> 42 </body>