diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /testing/web-platform/tests/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html')
-rw-r--r-- | testing/web-platform/tests/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html | 46 |
1 files changed, 33 insertions, 13 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 ffb419f799..2d5e22fa71 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 @@ -17,7 +17,7 @@ case "none": { let couldRequestStorageAccessForNone = true; try { - await document.requestStorageAccess({}); + await test_driver.bless("fake user interaction", () => document.requestStorageAccess({})); } catch (_) { couldRequestStorageAccessForNone = false; } @@ -26,7 +26,7 @@ } let couldRequestStorageAccessForAllFalse = true; try { - await document.requestStorageAccess({all:false}); + await test_driver.bless("fake user interaction", () => document.requestStorageAccess({all:false})); } catch (_) { couldRequestStorageAccessForAllFalse = false; } @@ -44,7 +44,7 @@ if (hasUnpartitionedCookieAccess || document.cookie.includes("test="+id)) { message = "First-party cookies should not be readable before handle is loaded."; } - await document.requestStorageAccess({cookies: true}); + await test_driver.bless("fake user interaction", () => document.requestStorageAccess({cookies: true})); hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (!hasUnpartitionedCookieAccess || !document.cookie.includes("test="+id)) { message = "First-party cookies should be readable if cookies were requested."; @@ -52,7 +52,7 @@ break; } case "sessionStorage": { - const handle = await document.requestStorageAccess({sessionStorage: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({sessionStorage: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -77,7 +77,7 @@ break; } case "localStorage": { - const handle = await document.requestStorageAccess({localStorage: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({localStorage: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -102,7 +102,7 @@ break; } case "indexedDB": { - const handle = await document.requestStorageAccess({indexedDB: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({indexedDB: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -119,7 +119,7 @@ break; } case "locks": { - const handle = await document.requestStorageAccess({locks: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({locks: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -136,7 +136,7 @@ break; } case "caches": { - const handle = await document.requestStorageAccess({caches: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({caches: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -153,7 +153,7 @@ break; } case "getDirectory": { - const handle = await document.requestStorageAccess({getDirectory: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({getDirectory: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -172,7 +172,7 @@ break; } case "estimate": { - const handle = await document.requestStorageAccess({estimate: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({estimate: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -188,7 +188,7 @@ break; } case "blobStorage": { - const handle = await document.requestStorageAccess({createObjectURL: true, revokeObjectURL: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({createObjectURL: true, revokeObjectURL: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -230,7 +230,7 @@ break; } case "BroadcastChannel": { - const handle = await document.requestStorageAccess({BroadcastChannel: true}); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({BroadcastChannel: true})); let hasUnpartitionedCookieAccess = await document.hasUnpartitionedCookieAccess(); if (hasUnpartitionedCookieAccess) { message = "First-party cookies should not be readable if not requested."; @@ -243,6 +243,26 @@ local_channel.close(); break; } + case "SharedWorker": { + const local_shared_worker = new SharedWorker("/storage-access-api/resources/shared-worker-relay.js", id); + local_shared_worker.port.start(); + local_shared_worker.port.postMessage("Same-origin local access"); + const handle = await test_driver.bless("fake user interaction", () => document.requestStorageAccess({SharedWorker: true})); + let couldRequestAllCookies = true; + try { + handle.SharedWorker("/storage-access-api/resources/shared-worker-relay.js", {name: id, sameSiteCookies: 'all'}); + } catch (_) { + couldRequestAllCookies = false; + } + if (couldRequestAllCookies) { + message = "Shared Workers in a third-party context should not be able to request SameSite cookies."; + } + handle.SharedWorker("/storage-access-api/resources/shared-worker-cookies.py", id).port.start(); + const handle_shared_worker = handle.SharedWorker("/storage-access-api/resources/shared-worker-relay.js", {name: id, sameSiteCookies: 'none'}); + handle_shared_worker.port.start(); + handle_shared_worker.port.postMessage("Same-origin handle access"); + break; + } default: { message = "Unexpected type " + type; break; @@ -254,6 +274,6 @@ // Step 7 (storage-access-api/storage-access-beyond-cookies.{}.tentative.sub.https.html) await MaybeSetStorageAccess("*", "*", "allowed"); await test_driver.set_permission({ name: 'storage-access' }, 'prompt'); - window.top.postMessage(message, "*"); + window.top.postMessage({type: "result", message: message}, "*"); })(); </script> |