summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /dom/indexedDB/test
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/indexedDB/test')
-rw-r--r--dom/indexedDB/test/mochitest-common.toml3
-rw-r--r--dom/indexedDB/test/test_open_and_databases.html19
-rw-r--r--dom/indexedDB/test/test_third_party.html8
-rw-r--r--dom/indexedDB/test/unit/test_connection_idle_maintenance.js2
-rw-r--r--dom/indexedDB/test/unit/test_connection_idle_maintenance_stop.js2
-rw-r--r--dom/indexedDB/test/unit/test_open_and_databases.js76
-rw-r--r--dom/indexedDB/test/unit/xpcshell-head-parent-process.js8
-rw-r--r--dom/indexedDB/test/unit/xpcshell-shared.toml2
8 files changed, 112 insertions, 8 deletions
diff --git a/dom/indexedDB/test/mochitest-common.toml b/dom/indexedDB/test/mochitest-common.toml
index d42228da45..0959f36e13 100644
--- a/dom/indexedDB/test/mochitest-common.toml
+++ b/dom/indexedDB/test/mochitest-common.toml
@@ -73,6 +73,7 @@ support-files = [
"unit/test_objectStore_remove_values.js",
"unit/test_object_identity.js",
"unit/test_odd_result_order.js",
+ "unit/test_open_and_databases.js",
"unit/test_open_empty_db.js",
"unit/test_open_for_principal.js",
"unit/test_open_objectStore.js",
@@ -299,6 +300,8 @@ skip-if = [
["test_odd_result_order.html"]
+["test_open_and_databases.html"]
+
["test_open_empty_db.html"]
["test_open_for_principal.html"]
diff --git a/dom/indexedDB/test/test_open_and_databases.html b/dom/indexedDB/test/test_open_and_databases.html
new file mode 100644
index 0000000000..9d0113136e
--- /dev/null
+++ b/dom/indexedDB/test/test_open_and_databases.html
@@ -0,0 +1,19 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+ <title>Indexed Database Property Test</title>
+
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+
+ <script type="text/javascript" src="unit/test_open_and_databases.js"></script>
+ <script type="text/javascript" src="helpers.js"></script>
+
+</head>
+
+<body onload="runTest();"></body>
+
+</html>
diff --git a/dom/indexedDB/test/test_third_party.html b/dom/indexedDB/test/test_third_party.html
index ee90de8dac..439f50d754 100644
--- a/dom/indexedDB/test/test_third_party.html
+++ b/dom/indexedDB/test/test_third_party.html
@@ -25,12 +25,12 @@
{ host: "http://sub1.test2.example.org:8000", cookieBehavior: BEHAVIOR_REJECT, expectedResultFrame1: false, expectedResultFrame2: false },
{ host: "http://" + window.location.host, cookieBehavior: BEHAVIOR_REJECTFOREIGN, expectedResultFrame1: true, expectedResultFrame2: true },
- { host: "http://example.com", cookieBehavior: BEHAVIOR_REJECTFOREIGN, expectedResultFrame1: false, expectedResultFrame2: true },
- { host: "http://sub1.test2.example.org:8000", cookieBehavior: BEHAVIOR_REJECTFOREIGN, expectedResultFrame1: false, expectedResultFrame2: true },
+ { host: "http://example.com", cookieBehavior: BEHAVIOR_REJECTFOREIGN, expectedResultFrame1: false, expectedResultFrame2: false },
+ { host: "http://sub1.test2.example.org:8000", cookieBehavior: BEHAVIOR_REJECTFOREIGN, expectedResultFrame1: false, expectedResultFrame2: false },
{ host: "http://" + window.location.host, cookieBehavior: BEHAVIOR_LIMITFOREIGN, expectedResultFrame1: true, expectedResultFrame2: true },
- { host: "http://example.com", cookieBehavior: BEHAVIOR_LIMITFOREIGN, expectedResultFrame1: false, expectedResultFrame2: true },
- { host: "http://sub1.test2.example.org:8000", cookieBehavior: BEHAVIOR_LIMITFOREIGN, expectedResultFrame1: false, expectedResultFrame2: true },
+ { host: "http://example.com", cookieBehavior: BEHAVIOR_LIMITFOREIGN, expectedResultFrame1: false, expectedResultFrame2: false },
+ { host: "http://sub1.test2.example.org:8000", cookieBehavior: BEHAVIOR_LIMITFOREIGN, expectedResultFrame1: false, expectedResultFrame2: false },
];
const iframe1Path =
diff --git a/dom/indexedDB/test/unit/test_connection_idle_maintenance.js b/dom/indexedDB/test/unit/test_connection_idle_maintenance.js
index 288f656c65..819b0b61bb 100644
--- a/dom/indexedDB/test/unit/test_connection_idle_maintenance.js
+++ b/dom/indexedDB/test/unit/test_connection_idle_maintenance.js
@@ -8,7 +8,7 @@ async function testSteps() {
// A constant used to deal with small decrease in usage when transactions are
// transferred from the WAL file back into the original database, also called
// as checkpointing.
- const cosmologicalConstant = 31768;
+ const cosmologicalConstant = 20000;
// The length of time that database connections will be held open after all
// transactions have completed before doing idle maintenance.
diff --git a/dom/indexedDB/test/unit/test_connection_idle_maintenance_stop.js b/dom/indexedDB/test/unit/test_connection_idle_maintenance_stop.js
index 33dc69b210..5453e4dc4e 100644
--- a/dom/indexedDB/test/unit/test_connection_idle_maintenance_stop.js
+++ b/dom/indexedDB/test/unit/test_connection_idle_maintenance_stop.js
@@ -8,7 +8,7 @@ async function testSteps() {
// A constant used to deal with small decrease in usage when transactions are
// transferred from the WAL file back into the original database, also called
// as checkpointing.
- const cosmologicalConstant = 32768;
+ const cosmologicalConstant = 35000;
// The maximum number of threads that can be used for database activity at a
// single time.
diff --git a/dom/indexedDB/test/unit/test_open_and_databases.js b/dom/indexedDB/test/unit/test_open_and_databases.js
new file mode 100644
index 0000000000..b13cba067a
--- /dev/null
+++ b/dom/indexedDB/test/unit/test_open_and_databases.js
@@ -0,0 +1,76 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+/* exported testSteps */
+async function testSteps() {
+ const openInfos = [
+ { name: "foo-a", version: 1 },
+ { name: "foo-b", version: 1 },
+ ];
+
+ info("Creating databases");
+
+ for (let index = 0; index < openInfos.length; index++) {
+ const openInfo = openInfos[index];
+
+ const request = indexedDB.open(openInfo.name, openInfo.version);
+
+ await expectingUpgrade(request);
+
+ const event = await expectingSuccess(request);
+
+ const database = event.target.result;
+
+ database.close();
+ }
+
+ info("Getting databases");
+
+ const databasesPromise = indexedDB.databases();
+
+ info("Opening databases");
+
+ const openPromises = [];
+
+ for (let index = 0; index < openInfos.length; index++) {
+ const openInfo = openInfos[index];
+
+ const request = indexedDB.open(openInfo.name, openInfo.version);
+
+ const promise = expectingSuccess(request);
+
+ openPromises.push(promise);
+ }
+
+ info("Waiting for databases operation to complete");
+
+ const databaseInfos = await databasesPromise;
+
+ info("Verifying databases");
+
+ is(
+ databaseInfos.length,
+ openInfos.length,
+ "The result of databases() should contain one result per database"
+ );
+
+ for (let index = 0; index < openInfos.length; index++) {
+ const openInfo = openInfos[index];
+
+ ok(
+ databaseInfos.some(function (element) {
+ return (
+ element.name === openInfo.name && element.version === openInfo.version
+ );
+ }),
+ "The result of databases() should be a sequence of the correct names " +
+ "and versions of all databases for the origin"
+ );
+ }
+
+ info("Waiting for open operations to complete");
+
+ await Promise.all(openPromises);
+}
diff --git a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
index f6bd2608ef..840eef7908 100644
--- a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
+++ b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
@@ -56,7 +56,11 @@ if (!this.runTest) {
if (testSteps.constructor.name === "AsyncFunction") {
// Do run our existing cleanup function that would normally be called by
// the generator's call to finishTest().
- registerCleanupFunction(resetTesting);
+ registerCleanupFunction(function () {
+ if (SpecialPowers.isMainProcess()) {
+ resetTesting();
+ }
+ });
add_task(testSteps);
@@ -644,7 +648,7 @@ var SpecialPowers = {
clearUserPref(prefName) {
Services.prefs.clearUserPref(prefName);
},
- // Copied (and slightly adjusted) from testing/specialpowers/content/SpecialPowersAPI.jsm
+ // Copied (and slightly adjusted) from testing/specialpowers/api.js
exactGC(callback) {
let count = 0;
diff --git a/dom/indexedDB/test/unit/xpcshell-shared.toml b/dom/indexedDB/test/unit/xpcshell-shared.toml
index ac1183ab2d..f967236a9e 100644
--- a/dom/indexedDB/test/unit/xpcshell-shared.toml
+++ b/dom/indexedDB/test/unit/xpcshell-shared.toml
@@ -111,6 +111,8 @@ skip-if = ["os == 'android'"] # bug 864843
["test_odd_result_order.js"]
+["test_open_and_databases.js"]
+
["test_open_empty_db.js"]
["test_open_for_principal.js"]