summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html')
-rw-r--r--testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html b/testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html
new file mode 100644
index 0000000000..16bdacf6c6
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: partitioned storage test</title>
+<meta name=help href="https://privacycg.github.io/storage-partitioning/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<iframe id="shared-iframe" src="http://{{host}}:{{ports[http][0]}}/IndexedDB/resources/idb-partitioned-basic-iframe.tentative.html"></iframe>
+<body>
+<script>
+// Here's the set-up for this test:
+// Step 1. (window) set up listeners for main window.
+// Step 2. (same-site iframe) loads, creates a database, and sends "same-site iframe loaded" message.
+// Step 3. (window) receives "same-site iframe loaded" message and opens cross-site window.
+// Step 4. (cross-site iframe) loads, checks if database exists, and sends "cross-site iframe loaded" message.
+// Step 5. (window) receives "cross-site iframe loaded" message, asserts that database should not exist, sends "delete database" message.
+// Step 6. (same-site iframe) receives "delete database" message, deletes the database, sends "database deleted" message.
+// Step 7. (window) receives the "database deleted" and then exits.
+const altOrigin = "http://{{hosts[alt][]}}:{{ports[http][0]}}";
+
+async_test(t => {
+ const iframe = document.getElementById("shared-iframe");
+
+ // Step 1
+ window.addEventListener("message", t.step_func(e => {
+
+ // Step 3
+ if (e.data.message === "same-site iframe loaded") {
+ if (location.origin !== altOrigin) {
+ const crossSiteWindow = window.open(`${altOrigin}/IndexedDB/idb-partitioned-basic.tentative.sub.html`, "", "noopener=false");
+ t.add_cleanup(() => crossSiteWindow.close());
+ }
+ }
+
+ // Step 5
+ if (e.data.message === "cross-site iframe loaded") {
+ t.step(() => {
+ assert_false(
+ e.data.doesDatabaseExist,
+ "The cross-site iframe should not see the same-site database",
+ );
+ });
+ iframe.contentWindow.postMessage(
+ {message: "delete database"},
+ iframe.contentWindow.origin,
+ );
+ };
+
+ // Step 7
+ if (e.data.message === "database deleted") {
+ t.done();
+ };
+ }));
+}, "Simple test for partitioned IndexedDB");
+</script>
+</body>