diff options
Diffstat (limited to 'testing/web-platform/tests/storage-access-api')
6 files changed, 76 insertions, 28 deletions
diff --git a/testing/web-platform/tests/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html b/testing/web-platform/tests/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html index 2d5e22fa71..77f1163f36 100644 --- a/testing/web-platform/tests/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html +++ b/testing/web-platform/tests/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html @@ -149,6 +149,53 @@ if (local_has) { message = "Handle should not override window Cache Storage"; } + document.cookie = "partitioned=test; SameSite=None; Secure; Partitioned;"; + const cache = await handle.caches.open(id); + await cache.add("/storage-access-api/resources/get_cookies.py?2"); + await test_driver.bless("fake user interaction", () => document.requestStorageAccess()); + await cache.add("/storage-access-api/resources/get_cookies.py?3"); + let req = await cache.match("/storage-access-api/resources/get_cookies.py?1"); + let req_json = await req.json(); + if (!req_json.hasOwnProperty("samesite_strict")) { + message = "Top-level cache fetch should have SameSite=Strict cookies."; + } + if (!req_json.hasOwnProperty("samesite_lax")) { + message = "Top-level cache fetch should have SameSite=Lax cookies."; + } + if (!req_json.hasOwnProperty("samesite_none")) { + message = "Top-level cache fetch should have SameSite=None cookies."; + } + if (req_json.hasOwnProperty("partitioned")) { + message = "Top-level cache fetch should not have partitioned cookies."; + } + req = await cache.match("/storage-access-api/resources/get_cookies.py?2"); + req_json = await req.json(); + if (req_json.hasOwnProperty("samesite_strict")) { + message = "SAA cache fetch should not have SameSite=Strict cookies."; + } + if (req_json.hasOwnProperty("samesite_lax")) { + message = "SAA cache fetch should not have SameSite=Lax cookies."; + } + if (req_json.hasOwnProperty("samesite_none")) { + message = "SAA cache fetch should not have SameSite=None cookies."; + } + if (!req_json.hasOwnProperty("partitioned")) { + message = "SAA cache fetch should have partitioned cookies."; + } + req = await cache.match("/storage-access-api/resources/get_cookies.py?3"); + req_json = await req.json(); + if (req_json.hasOwnProperty("samesite_strict")) { + message = "SAA cache + cookie fetch should not have SameSite=Strict cookies."; + } + if (req_json.hasOwnProperty("samesite_lax")) { + message = "SAA cache + cookie fetch should not have SameSite=Lax cookies."; + } + if (!req_json.hasOwnProperty("samesite_none")) { + message = "SAA cache + cookie fetch should have SameSite=None cookies."; + } + if (!req_json.hasOwnProperty("partitioned")) { + message = "SAA cache + cookie fetch should have partitioned cookies."; + } await handle.caches.delete(id); break; } diff --git a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.SharedWorker.tentative.sub.https.window.js b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.SharedWorker.tentative.sub.https.window.js index ed4f25517f..613a47ba1b 100644 --- a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.SharedWorker.tentative.sub.https.window.js +++ b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.SharedWorker.tentative.sub.https.window.js @@ -30,11 +30,10 @@ async_test(t => { assert_equals(e.data, "Same-origin handle access", "Relay worker should divert messages here"); // Step 8 const cookie_worker = new SharedWorker("/storage-access-api/resources/shared-worker-cookies.py", {name: id, sameSiteCookies: 'none'}); - cookie_worker.port.onmessage = t.step_func(e => { + cookie_worker.port.onmessage = t.step_func(async (e) => { assert_equals(e.data, "ReadOnLoad:None,ReadOnFetch:None,ConnectionsMade:2", "Worker should already have been opened and only see SameSite=None cookies"); - test_driver.delete_all_cookies().then(t.step_func(() => { - t.done(); - })); + await test_driver.delete_all_cookies(); + t.done(); }); }); diff --git a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.caches.tentative.sub.https.window.js b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.caches.tentative.sub.https.window.js index 7907084e63..51e5c648a6 100644 --- a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.caches.tentative.sub.https.window.js +++ b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.caches.tentative.sub.https.window.js @@ -15,18 +15,24 @@ async_test(t => { // Step 1 - window.addEventListener("message", t.step_func(e => { + window.addEventListener("message", t.step_func((e) => { if (e.data.type != "result") { return; } // Step 8 assert_equals(e.data.message, "HasAccess for caches", "Storage Access API should be accessible and return first-party data"); + t.add_cleanup(() => {test_driver.delete_all_cookies();}); t.done(); })); // Step 2 const id = Date.now(); - window.caches.open(id).then(() => { + document.cookie = "samesite_strict=test; SameSite=Strict; Secure"; + document.cookie = "samesite_lax=test; SameSite=Lax; Secure"; + document.cookie = "samesite_none=test; SameSite=None; Secure"; + + window.caches.open(id).then(async (cache) => { + await cache.add("https://{{hosts[][]}}:{{ports[https][0]}}/storage-access-api/resources/get_cookies.py?1"); // Step 3 let iframe = document.createElement("iframe"); iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=caches&id="+id; diff --git a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.cookies.tentative.sub.https.window.js b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.cookies.tentative.sub.https.window.js index 1ff00fa919..ad760cfda7 100644 --- a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.cookies.tentative.sub.https.window.js +++ b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.cookies.tentative.sub.https.window.js @@ -15,15 +15,14 @@ async_test(t => { // Step 1 - window.addEventListener("message", t.step_func(e => { + window.addEventListener("message", t.step_func((e) => { if (e.data.type != "result") { return; } // Step 8 assert_equals(e.data.message, "HasAccess for cookies", "Storage Access API should be accessible and return first-party data"); - test_driver.delete_all_cookies().then(t.step_func(() => { - t.done(); - })); + t.add_cleanup(() => {test_driver.delete_all_cookies();}); + t.done(); })); // Step 2 diff --git a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.estimate.tentative.sub.https.window.js b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.estimate.tentative.sub.https.window.js index fb15dfee09..eb8cb0c68d 100644 --- a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.estimate.tentative.sub.https.window.js +++ b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.estimate.tentative.sub.https.window.js @@ -17,24 +17,22 @@ async_test(t => { const id = "test"; // Step 1 - window.addEventListener("message", t.step_func(e => { + window.addEventListener("message", t.step_func((e) => { if (e.data.type != "result") { return; } // Step 8 assert_equals(e.data.message, "HasAccess for estimate", "Storage Access API should be accessible and return first-party data"); - caches.delete(id).then(() => { - t.done(); - }); + t.add_cleanup(() => {caches.delete(id);}); + t.done(); })); // Step 2 - window.caches.open(id).then((cache) => { - cache.put('/test.json', new Response('x'.repeat(1024*1024))).then(() => { - // Step 3 - let iframe = document.createElement("iframe"); - iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=estimate&id="+id; - document.body.appendChild(iframe); - }); + window.caches.open(id).then(async (cache) => { + await cache.put('/test.json', new Response('x'.repeat(1024*1024))); + // Step 3 + let iframe = document.createElement("iframe"); + iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=estimate&id="+id; + document.body.appendChild(iframe); }); }, "Verify StorageAccessAPIBeyondCookies for Quota"); diff --git a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.getDirectory.tentative.sub.https.window.js b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.getDirectory.tentative.sub.https.window.js index b3b8f7e8e2..d59caa93cd 100644 --- a/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.getDirectory.tentative.sub.https.window.js +++ b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.getDirectory.tentative.sub.https.window.js @@ -26,12 +26,11 @@ async_test(t => { // Step 2 const id = Date.now(); - window.navigator.storage.getDirectory().then((root) => { - root.getFileHandle(id, {create: true}).then(() => { - // Step 3 - let iframe = document.createElement("iframe"); - iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=getDirectory&id="+id; - document.body.appendChild(iframe); - }); + window.navigator.storage.getDirectory().then(async (root) => { + await root.getFileHandle(id, {create: true}); + // Step 3 + let iframe = document.createElement("iframe"); + iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=getDirectory&id="+id; + document.body.appendChild(iframe); }); }, "Verify StorageAccessAPIBeyondCookies for Origin Private File System"); |