diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.getDirectory.tentative.sub.https.window.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.getDirectory.tentative.sub.https.window.js')
-rw-r--r-- | testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.getDirectory.tentative.sub.https.window.js | 34 |
1 files changed, 34 insertions, 0 deletions
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 new file mode 100644 index 0000000000..5038afc969 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/storage-access-beyond-cookies.getDirectory.tentative.sub.https.window.js @@ -0,0 +1,34 @@ +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js + +'use strict'; + +// Here's the set-up for this test: +// Step 1 (top-frame) Set up listener for "HasAccess" message. +// Step 2 (top-frame) Write first-party file. +// Step 3 (top-frame) Embed an iframe that's cross-site with top-frame. +// Step 4 (sub-frame) Try to use storage access API and read first-party data. +// Step 5 (sub-frame) Embed an iframe that's same-origin with top-frame. +// Step 6 (sub-sub-frame) Try to use storage access API and read first-party data. +// Step 7 (sub-sub-frame) Send "HasAccess for getDirectory" message to top-frame. +// Step 8 (top-frame) Receive "HasAccess for getDirectory" message and cleanup. + +async_test(t => { + // Step 1 + window.addEventListener("message", t.step_func(e => { + // Step 8 + assert_equals(e.data, "HasAccess for getDirectory", "Storage Access API should be accessible and return first-party data"); + t.done(); + })); + + // 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); + }); + }); +}, "Verify StorageAccessAPIBeyondCookies for Origin Private File System"); |