third-party.none.tentative.sub.https.window.js (1562B)
1 // META: script=/resources/testdriver.js 2 // META: script=/resources/testdriver-vendor.js 3 // META: script=/workers/same-site-cookies/resources/util.js 4 5 'use strict'; 6 7 // Here's the set-up for this test: 8 // Step 1 (window) Set cookies. 9 // Step 2 (top-frame) Set up listener for cookie message and open cross-site iframe. 10 // Step 3 (sub-frame) Open iframe same-site to top-frame. 11 // Step 4 (sub-sub-frame) Set up listener for message and start worker. 12 // Step 5 (redirect) Redirect to worker script. 13 // Step 6 (worker) Send cookie message to iframe. 14 // Step 7 (sub-sub-frame) Receive message and pass on to window. 15 // Step 8 (top-frame) Receive cookie message and cleanup. 16 17 async_test(t => { 18 // Step 1 19 const cookie_set_window = window.open("/workers/same-site-cookies/resources/set_cookies.py"); 20 cookie_set_window.onload = t.step_func(_ => { 21 // Step 2 22 window.addEventListener("message", t.step_func(e => { 23 // Step 8 24 getCookieNames().then(t.step_func((cookies) => { 25 assert_equals(e.data + cookies, "ReadOnLoad:None,ReadOnFetch:None,SetOnRedirectLoad:None,SetOnLoad:None,SetOnRedirectFetch:None,SetOnFetch:None", "Worker should get/set SameSite=None cookies only"); 26 cookie_set_window.close(); 27 t.done(); 28 })); 29 })); 30 let iframe = document.createElement("iframe"); 31 iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/workers/same-site-cookies/resources/iframe.sub.html?type=none"; 32 document.body.appendChild(iframe); 33 }); 34 }, "Check SharedWorker sameSiteCookies option none for third-party");