Skip to content

Truly independent web browser

Tests/LibWeb: Import IndexedDB tests

Andreas Kling15fe70addc4f
diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.ini
index 3a6837beff9..0e837c5c6bd 100644
--- a/Tests/LibWeb/TestConfig.ini
+++ b/Tests/LibWeb/TestConfig.ini
@@ -484,6 +484,25 @@ Text/input/wpt-import/IndexedDB/keypath_invalid.any.sharedworker.html
Text/input/wpt-import/IndexedDB/keypath_invalid.any.worker.html
Text/input/wpt-import/IndexedDB/transaction-abort-index-metadata-revert.any.worker.html
Text/input/wpt-import/encoding/encodeInto.any.worker.html
+Text/input/wpt-import/IndexedDB/get-databases.any.worker.html
+Text/input/wpt-import/IndexedDB/idbcursor-key.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/idbcursor-key.any.worker.html
+Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.html
+Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.html
+Text/input/wpt-import/IndexedDB/idbindex-rename.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/idbindex-rename.any.worker.html
+Text/input/wpt-import/IndexedDB/idbrequest_error.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/idbrequest_error.any.worker.html
+Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.html
+Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.html
+Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.html
+Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.html
+Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.html
Text/input/wpt-import/WebCryptoAPI/historical.any.worker.html
Text/input/Worker/Worker-close-after-postMessage.html
Text/input/Worker/Worker-crypto.html
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/get-databases.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/get-databases.any.txt
new file mode 100644
index 00000000000..2ad30e0cceb
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/get-databases.any.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 5 tests
+
+4 Pass
+1 Fail
+Pass Ensure that databases() returns a promise.
+Pass Enumerate one database.
+Pass Enumerate multiple databases.
+Pass Make sure an empty list is returned for the case of no databases.
+Fail Ensure that databases() doesn't pick up changes that haven't commited.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/get-databases.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/get-databases.any.worker.txt
new file mode 100644
index 00000000000..2ad30e0cceb
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/get-databases.any.worker.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 5 tests
+
+4 Pass
+1 Fail
+Pass Ensure that databases() returns a promise.
+Pass Enumerate one database.
+Pass Enumerate multiple databases.
+Pass Make sure an empty list is returned for the case of no databases.
+Fail Ensure that databases() doesn't pick up changes that haven't commited.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.sharedworker.txt
new file mode 100644
index 00000000000..594526ae399
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.sharedworker.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 3 tests
+
+2 Pass
+1 Fail
+Pass IDBCursor.key
+Pass IDBCursor.key 1
+Fail IDBCursor.key 2
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.txt
new file mode 100644
index 00000000000..594526ae399
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 3 tests
+
+2 Pass
+1 Fail
+Pass IDBCursor.key
+Pass IDBCursor.key 1
+Fail IDBCursor.key 2
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.worker.txt
new file mode 100644
index 00000000000..594526ae399
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-key.any.worker.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 3 tests
+
+2 Pass
+1 Fail
+Pass IDBCursor.key
+Pass IDBCursor.key 1
+Fail IDBCursor.key 2
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.sharedworker.txt
new file mode 100644
index 00000000000..0d77e14bf58
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.sharedworker.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 3 tests
+
+2 Pass
+1 Fail
+Pass IDBCursor.primaryKey
+Pass IDBCursor.primaryKey 1
+Fail IDBCursor.primaryKey 2
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.txt
new file mode 100644
index 00000000000..0d77e14bf58
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 3 tests
+
+2 Pass
+1 Fail
+Pass IDBCursor.primaryKey
+Pass IDBCursor.primaryKey 1
+Fail IDBCursor.primaryKey 2
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.txt
new file mode 100644
index 00000000000..0d77e14bf58
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 3 tests
+
+2 Pass
+1 Fail
+Pass IDBCursor.primaryKey
+Pass IDBCursor.primaryKey 1
+Fail IDBCursor.primaryKey 2
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.sharedworker.txt
new file mode 100644
index 00000000000..b1bc8a580bd
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.sharedworker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Properties of error event from failed open()
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.txt
new file mode 100644
index 00000000000..b1bc8a580bd
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Properties of error event from failed open()
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.txt
new file mode 100644
index 00000000000..b1bc8a580bd
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Properties of error event from failed open()
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.sharedworker.txt
new file mode 100644
index 00000000000..275fc77a9f4
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.sharedworker.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 9 tests
+
+7 Pass
+2 Fail
+Fail IndexedDB index rename in new transaction
+Fail IndexedDB index rename in the transaction where it is created
+Pass IndexedDB index rename to the same name succeeds
+Pass IndexedDB index rename to the name of a deleted index succeeds
+Pass IndexedDB index swapping via renames succeeds
+Pass IndexedDB index rename stringifies non-string names
+Pass IndexedDB index can be renamed to ""
+Pass IndexedDB index can be renamed to "\u0000"
+Pass IndexedDB index can be renamed to "\uDC00\uD800"
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.txt
new file mode 100644
index 00000000000..275fc77a9f4
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 9 tests
+
+7 Pass
+2 Fail
+Fail IndexedDB index rename in new transaction
+Fail IndexedDB index rename in the transaction where it is created
+Pass IndexedDB index rename to the same name succeeds
+Pass IndexedDB index rename to the name of a deleted index succeeds
+Pass IndexedDB index swapping via renames succeeds
+Pass IndexedDB index rename stringifies non-string names
+Pass IndexedDB index can be renamed to ""
+Pass IndexedDB index can be renamed to "\u0000"
+Pass IndexedDB index can be renamed to "\uDC00\uD800"
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.worker.txt
new file mode 100644
index 00000000000..275fc77a9f4
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbindex-rename.any.worker.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 9 tests
+
+7 Pass
+2 Fail
+Fail IndexedDB index rename in new transaction
+Fail IndexedDB index rename in the transaction where it is created
+Pass IndexedDB index rename to the same name succeeds
+Pass IndexedDB index rename to the name of a deleted index succeeds
+Pass IndexedDB index swapping via renames succeeds
+Pass IndexedDB index rename stringifies non-string names
+Pass IndexedDB index can be renamed to ""
+Pass IndexedDB index can be renamed to "\u0000"
+Pass IndexedDB index can be renamed to "\uDC00\uD800"
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.sharedworker.txt
new file mode 100644
index 00000000000..52bbe80682f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.sharedworker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail IDBRequest.error throws if ready state is pending
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.txt
new file mode 100644
index 00000000000..52bbe80682f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail IDBRequest.error throws if ready state is pending
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.worker.txt
new file mode 100644
index 00000000000..52bbe80682f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbrequest_error.any.worker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail IDBRequest.error throws if ready state is pending
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.sharedworker.txt
new file mode 100644
index 00000000000..00e9ee1453a
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.sharedworker.txt
@@ -0,0 +1,14 @@
+Harness status: OK
+
+Found 8 tests
+
+6 Pass
+2 Fail
+Pass IDBTransaction.objectStoreNames - during upgrade transaction
+Pass IDBTransaction.objectStoreNames - value after close
+Pass IDBTransaction.objectStoreNames - transaction scope
+Pass IDBTransaction.objectStoreNames - value after commit
+Pass IDBTransaction.objectStoreNames - value after abort
+Pass IDBTransaction.objectStoreNames - sorting
+Fail IDBTransaction.objectStoreNames - no duplicates
+Fail IDBTransaction.objectStoreNames - unusual names
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.txt
new file mode 100644
index 00000000000..00e9ee1453a
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.txt
@@ -0,0 +1,14 @@
+Harness status: OK
+
+Found 8 tests
+
+6 Pass
+2 Fail
+Pass IDBTransaction.objectStoreNames - during upgrade transaction
+Pass IDBTransaction.objectStoreNames - value after close
+Pass IDBTransaction.objectStoreNames - transaction scope
+Pass IDBTransaction.objectStoreNames - value after commit
+Pass IDBTransaction.objectStoreNames - value after abort
+Pass IDBTransaction.objectStoreNames - sorting
+Fail IDBTransaction.objectStoreNames - no duplicates
+Fail IDBTransaction.objectStoreNames - unusual names
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.txt
new file mode 100644
index 00000000000..f82ff137842
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail IndexedDB Request Event Propagation: Bubbling and Capturing
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.txt
new file mode 100644
index 00000000000..f82ff137842
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail IndexedDB Request Event Propagation: Bubbling and Capturing
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.txt
new file mode 100644
index 00000000000..f82ff137842
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail IndexedDB Request Event Propagation: Bubbling and Capturing
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.txt
new file mode 100644
index 00000000000..f4e6f747ca6
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Properties of error events fired at requests when aborting a transaction
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.txt
new file mode 100644
index 00000000000..f4e6f747ca6
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Properties of error events fired at requests when aborting a transaction
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.txt
new file mode 100644
index 00000000000..f4e6f747ca6
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Properties of error events fired at requests when aborting a transaction
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.txt
new file mode 100644
index 00000000000..d4505b2ffd9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Capture and bubble
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.txt
new file mode 100644
index 00000000000..d4505b2ffd9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Capture and bubble
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.txt
new file mode 100644
index 00000000000..d4505b2ffd9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Capture and bubble
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.html
new file mode 100644
index 00000000000..e8633fd963c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support-promises.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/get-databases.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.js
new file mode 100644
index 00000000000..77f091f5581
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.js
@@ -0,0 +1,139 @@
+// META: script=resources/support-promises.js
+'use strict';
+
+promise_test(async testCase => {
+ let result = indexedDB.databases();
+ assert_true(result instanceof Promise,
+ "databases() should return a promise.");
+ result.catch(() => {});
+}, "Ensure that databases() returns a promise.");
+
+promise_test(async testCase => {
+ // Delete any databases that may not have been cleaned up after previous test
+ // runs.
+ await deleteAllDatabases(testCase);
+
+ const db_name = "TestDatabase";
+ const db = await createNamedDatabase(testCase, db_name, ()=>{});
+ const databases_result = await indexedDB.databases();
+ db.close();
+ const expected_result = {"name": db_name, "version": 1};
+ assert_equals(
+ databases_result.length,
+ 1,
+ "The result of databases() should contain one result per database.");
+ assert_true(
+ databases_result[0].name === expected_result.name
+ && databases_result[0].version === expected_result.version,
+ "The result of databases() should be a sequence of the correct names "
+ + "and versions of all databases for the origin.");
+}, "Enumerate one database.");
+
+promise_test(async testCase => {
+ // Delete any databases that may not have been cleaned up after previous test
+ // runs.
+ await deleteAllDatabases(testCase);
+
+ const db_name1 = "TestDatabase1";
+ const db_name2 = "TestDatabase2";
+ const db_name3 = "TestDatabase3";
+ const db1 = await createNamedDatabase(testCase, db_name1, ()=>{});
+ const db2 = await createNamedDatabase(testCase, db_name2, ()=>{});
+ const db3 = await createNamedDatabase(testCase, db_name3, ()=>{});
+ db1.close();
+ db2.close();
+ db3.close();
+ const version_promise =
+ await migrateNamedDatabase(testCase, db_name2, 2, () => {});
+ const databases_result = await indexedDB.databases();
+ const expected_result = [
+ {"name": db_name1, "version": 1},
+ {"name": db_name2, "version": 2},
+ {"name": db_name3, "version": 1},
+ ];
+ assert_equals(
+ databases_result.length,
+ expected_result.length,
+ "The result of databases() should contain one result per database.");
+ for ( let i = 0; i < expected_result.length; i += 1 ) {
+ const result = expected_result[i];
+ assert_true(
+ databases_result.some(
+ e => e.name === result.name && e.version === result.version),
+ "The result of databases() should be a sequence of the correct names "
+ + "and versions of all databases for the origin.");
+ }
+}, "Enumerate multiple databases.");
+
+promise_test(async testCase => {
+ // Add some databases and close their connections.
+ const db1 = await createNamedDatabase(testCase, "DB1", () => {});
+ const db2 = await createNamedDatabase(testCase, "DB2", () => {});
+ db1.close();
+ db2.close();
+
+ // Delete any databases that may not have been cleaned up after previous test
+ // runs as well as the two databases made above.
+ await deleteAllDatabases(testCase);
+
+ // Make sure the databases are no longer returned.
+ const databases_result = await indexedDB.databases();
+ assert_equals(
+ databases_result.length,
+ 0,
+ "The result of databases() should be an empty sequence for the case of "
+ + "no databases for the origin.");
+}, "Make sure an empty list is returned for the case of no databases.");
+
+promise_test(async testCase => {
+ function sleep_sync(msec) {
+ const start = new Date().getTime();
+ while (new Date().getTime() - start < msec) {}
+ }
+
+ // Delete any databases that may not have been cleaned up after previous test
+ // runs as well as the two databases made above.
+ await deleteAllDatabases(testCase);
+
+ const db1 = await createNamedDatabase(testCase, "DB1", ()=>{});
+ let databases_promise1;
+ const db2 = await createNamedDatabase(testCase, "DB2", async () => {
+ databases_promise1 = indexedDB.databases();
+
+ // Give databases() operation a chance to fetch all current info about
+ // existing databases. This must be a sync sleep since await would trigger
+ // auto commit of the upgrade transaction.
+ sleep_sync(1000);
+ });
+ const databases_result1 = await databases_promise1;
+ assert_equals(
+ databases_result1.length,
+ 1,
+ "The result of databases() should be only those databases which have "
+ + "been created at the time of calling, regardless of versionchange "
+ + "transactions currently running.");
+ db1.close();
+ db2.close();
+ const databases_result2 = await indexedDB.databases();
+ assert_equals(
+ databases_result2.length,
+ 2,
+ "The result of databases() should include all databases which have "
+ + "been created at the time of calling.");
+ let databases_promise3;
+ await migrateNamedDatabase(testCase, "DB2", 2, async () => {
+ databases_promise3 = indexedDB.databases();
+
+ // Give databases() operation a chance to fetch all current info about
+ // existing databases. This must be a sync sleep since await would trigger
+ // auto commit of the upgrade transaction.
+ sleep_sync(1000);
+ });
+ const databases_result3 = await databases_promise3;
+ assert_true(
+ databases_result3[0].version === 1
+ && databases_result3[1].version === 1,
+ "The result of databases() should contain the versions of databases "
+ + "at the time of calling, regardless of versionchange transactions "
+ + "currently running.");
+}, "Ensure that databases() doesn't pick up changes that haven't commited.");
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.worker.html
new file mode 100644
index 00000000000..49d51cc35df
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/get-databases.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.worker.js
new file mode 100644
index 00000000000..55ff4285979
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/get-databases.any.worker.js
@@ -0,0 +1,10 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+importScripts("resources/support-promises.js")
+importScripts("/IndexedDB/get-databases.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.html
new file mode 100644
index 00000000000..734f2f4dd01
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBCursor.key</title>
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/idbcursor-key.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.js
new file mode 100644
index 00000000000..d8d2848377e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.js
@@ -0,0 +1,43 @@
+// META: global=window,worker
+// META: title=IDBCursor.key
+// META: script=resources/support.js
+
+'use strict';
+
+function cursor_key(key) {
+ async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore('test');
+ objStore.add('data', key);
+ };
+
+ open_rq.onsuccess = t.step_func((e) => {
+ const cursor_rq =
+ db.transaction('test', 'readonly').objectStore('test').openCursor();
+
+ cursor_rq.onsuccess = t.step_func((e) => {
+ const cursor = e.target.result;
+ assert_equals(cursor.value, 'data', 'prerequisite cursor.value');
+
+ assert_key_equals(cursor.key, key, 'key');
+ assert_readonly(cursor, 'key');
+
+ if (key instanceof Array) {
+ cursor.key.push('new');
+ key.push('new');
+
+ assert_key_equals(cursor.key, key, 'key after array push');
+ }
+
+ t.done();
+ });
+ });
+ });
+}
+
+cursor_key(1);
+cursor_key('key');
+cursor_key(['my', 'key']);
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.sharedworker.html
new file mode 100644
index 00000000000..8255a45f463
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.sharedworker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBCursor.key</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/idbcursor-key.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.worker.html
new file mode 100644
index 00000000000..57a0c1eb50e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBCursor.key</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/idbcursor-key.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.worker.js
new file mode 100644
index 00000000000..2f00dfa2cba
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-key.any.worker.js
@@ -0,0 +1,11 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "IDBCursor.key";
+importScripts("resources/support.js")
+importScripts("/IndexedDB/idbcursor-key.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.html
new file mode 100644
index 00000000000..b5f126ca3fc
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBCursor.primaryKey</title>
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/idbcursor-primarykey.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.js
new file mode 100644
index 00000000000..8b9afc67760
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.js
@@ -0,0 +1,51 @@
+// META: global=window,worker
+// META: title=IDBCursor.primaryKey
+// META: script=resources/support.js
+
+'use strict';
+
+function cursor_primarykey(key) {
+ async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = t.step_func(e => {
+ db = e.target.result;
+ const objStore = db.createObjectStore('test');
+ objStore.createIndex('index', '');
+
+ objStore.add('data', key);
+ });
+
+ open_rq.onsuccess = t.step_func(e => {
+ const cursor_rq = db.transaction('test', 'readonly')
+ .objectStore('test')
+ .index('index')
+ .openCursor();
+
+ cursor_rq.onsuccess = t.step_func(e => {
+ const cursor = e.target.result;
+
+ assert_equals(cursor.value, 'data', 'prerequisite cursor.value');
+ assert_equals(cursor.key, 'data', 'prerequisite cursor.key');
+
+ assert_key_equals(cursor.primaryKey, key, 'primaryKey');
+ assert_readonly(cursor, 'primaryKey');
+
+ if (key instanceof Array) {
+ cursor.primaryKey.push('new');
+ key.push('new');
+
+ assert_key_equals(
+ cursor.primaryKey, key, 'primaryKey after array push');
+ }
+
+ t.done();
+ });
+ });
+ });
+}
+
+cursor_primarykey(1);
+cursor_primarykey('key');
+cursor_primarykey(['my', 'key']);
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.sharedworker.html
new file mode 100644
index 00000000000..1712af675f7
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.sharedworker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBCursor.primaryKey</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/idbcursor-primarykey.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.html
new file mode 100644
index 00000000000..b8ab94812ce
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBCursor.primaryKey</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/idbcursor-primarykey.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.js
new file mode 100644
index 00000000000..f9a60c05df8
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbcursor-primarykey.any.worker.js
@@ -0,0 +1,11 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "IDBCursor.primaryKey";
+importScripts("resources/support.js")
+importScripts("/IndexedDB/idbcursor-primarykey.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.html
new file mode 100644
index 00000000000..b0b4a923ec2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: Test IDBFactory open() error event properties</title>
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/idbfactory-open-error-properties.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.js
new file mode 100644
index 00000000000..d216e2a7dfd
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.js
@@ -0,0 +1,25 @@
+// META: title=IndexedDB: Test IDBFactory open() error event properties
+// META: global=window,worker
+// META: script=resources/support.js
+
+// Spec: https://w3c.github.io/IndexedDB/#dom-idbfactory-open
+
+'use strict';
+
+async_test(t => {
+ const dbname = self.location + '-' + t.name;
+ indexedDB.deleteDatabase(dbname);
+ const open = indexedDB.open(dbname);
+ open.onsuccess = t.unreached_func('open should not succeed');
+ open.onupgradeneeded = t.step_func(() => {
+ const tx = open.transaction;
+ tx.abort();
+ });
+ open.onerror = t.step_func(e => {
+ assert_equals(e.target, open, 'event target should be request');
+ assert_equals(e.type, 'error', 'Event type should be error');
+ assert_true(e.bubbles, 'Event should bubble');
+ assert_true(e.cancelable, 'Event should be cancelable');
+ t.done();
+ });
+}, 'Properties of error event from failed open()');
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.sharedworker.html
new file mode 100644
index 00000000000..516baf5ddbe
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.sharedworker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: Test IDBFactory open() error event properties</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/idbfactory-open-error-properties.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.html
new file mode 100644
index 00000000000..5d37d14a01e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: Test IDBFactory open() error event properties</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/idbfactory-open-error-properties.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.js
new file mode 100644
index 00000000000..9a1bba41c4f
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbfactory-open-error-properties.any.worker.js
@@ -0,0 +1,11 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "IndexedDB: Test IDBFactory open() error event properties";
+importScripts("resources/support.js")
+importScripts("/IndexedDB/idbfactory-open-error-properties.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.html
new file mode 100644
index 00000000000..3d97e6efd60
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: index renaming support</title>
+<meta name="timeout" content="long">
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support-promises.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/idbindex-rename.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.js
new file mode 100644
index 00000000000..3d2e58f6f71
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.js
@@ -0,0 +1,358 @@
+// META: title=IndexedDB: index renaming support
+// META: global=window,worker
+// META: script=resources/support-promises.js
+// META: timeout=long
+
+// Spec: https://w3c.github.io/IndexedDB/#dom-idbindex-name
+
+'use strict';
+
+promise_test(testCase => {
+ let authorIndex = null;
+ let authorIndex2 = null;
+ let renamedAuthorIndex = null;
+ let renamedAuthorIndex2 = null;
+ return createDatabase(
+ testCase,
+ (database, transaction) => {
+ const store = createBooksStore(testCase, database);
+ authorIndex = store.index('by_author');
+ })
+ .then(database => {
+ const transaction = database.transaction('books', 'readonly');
+ const store = transaction.objectStore('books');
+ assert_array_equals(
+ store.indexNames, ['by_author', 'by_title'],
+ 'Test setup should have created two indexes');
+ authorIndex2 = store.index('by_author');
+ return checkAuthorIndexContents(
+ testCase, authorIndex2,
+ 'The index should have the expected contents before any renaming')
+ .then(() => database.close());
+ })
+ .then(
+ () => migrateDatabase(
+ testCase, 2,
+ (database, transaction) => {
+ const store = transaction.objectStore('books');
+ renamedAuthorIndex = store.index('by_author');
+ renamedAuthorIndex.name = 'renamed_by_author';
+
+ assert_equals(
+ renamedAuthorIndex.name, 'renamed_by_author',
+ 'IDBIndex name should change immediately after a rename');
+ assert_array_equals(
+ store.indexNames, ['by_title', 'renamed_by_author'],
+ 'IDBObjectStore.indexNames should immediately reflect the rename');
+ assert_equals(
+ store.index('renamed_by_author'), renamedAuthorIndex,
+ 'IDBObjectStore.index should return the renamed index store when ' +
+ 'queried using the new name immediately after the rename');
+ assert_throws_dom(
+ 'NotFoundError', () => store.index('by_author'),
+ 'IDBObjectStore.index should throw when queried using the ' +
+ 'renamed index\'s old name immediately after the rename');
+ }))
+ .then(database => {
+ const transaction = database.transaction('books', 'readonly');
+ const store = transaction.objectStore('books');
+ assert_array_equals(
+ store.indexNames, ['by_title', 'renamed_by_author'],
+ 'IDBObjectStore.indexNames should still reflect the rename after ' +
+ 'the versionchange transaction commits');
+ renamedAuthorIndex2 = store.index('renamed_by_author');
+ return checkAuthorIndexContents(
+ testCase, renamedAuthorIndex2,
+ 'Renaming an index should not change its contents')
+ .then(() => database.close());
+ })
+ .then(() => {
+ assert_equals(
+ authorIndex.name, 'by_author',
+ 'IDBIndex obtained before the rename transaction should not ' +
+ 'reflect the rename');
+ assert_equals(
+ authorIndex2.name, 'by_author',
+ 'IDBIndex obtained before the rename transaction should not ' +
+ 'reflect the rename');
+ assert_equals(
+ renamedAuthorIndex.name, 'renamed_by_author',
+ 'IDBIndex used in the rename transaction should keep reflecting ' +
+ 'the new name after the transaction is committed');
+ assert_equals(
+ renamedAuthorIndex2.name, 'renamed_by_author',
+ 'IDBIndex obtained after the rename transaction should reflect ' +
+ 'the new name');
+ });
+}, 'IndexedDB index rename in new transaction');
+
+promise_test(testCase => {
+ let renamedAuthorIndex = null;
+ let renamedAuthorIndex2 = null;
+ return createDatabase(
+ testCase,
+ (database, transaction) => {
+ const store = createBooksStore(testCase, database);
+ renamedAuthorIndex = store.index('by_author');
+ renamedAuthorIndex.name = 'renamed_by_author';
+
+ assert_equals(
+ renamedAuthorIndex.name, 'renamed_by_author',
+ 'IDBIndex name should change immediately after a rename');
+ assert_array_equals(
+ store.indexNames, ['by_title', 'renamed_by_author'],
+ 'IDBObjectStore.indexNames should immediately reflect the rename');
+ assert_equals(
+ store.index('renamed_by_author'), renamedAuthorIndex,
+ 'IDBObjectStore.index should return the renamed index store when ' +
+ 'queried using the new name immediately after the rename');
+ assert_throws_dom(
+ 'NotFoundError', () => store.index('by_author'),
+ 'IDBObjectStore.index should throw when queried using the ' +
+ 'renamed index\'s old name immediately after the rename');
+ })
+ .then(database => {
+ const transaction = database.transaction('books', 'readonly');
+ const store = transaction.objectStore('books');
+ assert_array_equals(
+ store.indexNames, ['by_title', 'renamed_by_author'],
+ 'IDBObjectStore.indexNames should still reflect the rename after ' +
+ 'the versionchange transaction commits');
+ renamedAuthorIndex2 = store.index('renamed_by_author');
+ return checkAuthorIndexContents(
+ testCase, renamedAuthorIndex2,
+ 'Renaming an index should not change its contents')
+ .then(() => database.close());
+ })
+ .then(() => {
+ assert_equals(
+ renamedAuthorIndex.name, 'renamed_by_author',
+ 'IDBIndex used in the rename transaction should keep reflecting ' +
+ 'the new name after the transaction is committed');
+ assert_equals(
+ renamedAuthorIndex2.name, 'renamed_by_author',
+ 'IDBIndex obtained after the rename transaction should reflect ' +
+ 'the new name');
+ });
+}, 'IndexedDB index rename in the transaction where it is created');
+
+promise_test(testCase => {
+ return createDatabase(
+ testCase,
+ (database, transaction) => {
+ createBooksStore(testCase, database);
+ })
+ .then(database => {
+ database.close();
+ })
+ .then(
+ () => migrateDatabase(
+ testCase, 2,
+ (database, transaction) => {
+ const store = transaction.objectStore('books');
+ const index = store.index('by_author');
+ index.name = 'by_author';
+ assert_array_equals(
+ store.indexNames, ['by_author', 'by_title'],
+ 'Renaming an index to the same name should not change the ' +
+ 'index\'s IDBObjectStore.indexNames');
+ }))
+ .then(database => {
+ const transaction = database.transaction('books', 'readonly');
+ const store = transaction.objectStore('books');
+ assert_array_equals(
+ store.indexNames, ['by_author', 'by_title'],
+ 'Committing a transaction that renames a store to the same name ' +
+ 'should not change the index\'s IDBObjectStore.indexNames');
+ const index = store.index('by_author');
+ return checkAuthorIndexContents(
+ testCase, index,
+ 'Committing a transaction that renames an index to the same name ' +
+ 'should not change the index\'s contents')
+ .then(() => database.close());
+ });
+}, 'IndexedDB index rename to the same name succeeds');
+
+promise_test(testCase => {
+ return createDatabase(
+ testCase,
+ (database, transaction) => {
+ createBooksStore(testCase, database);
+ })
+ .then(database => {
+ database.close();
+ })
+ .then(
+ () => migrateDatabase(
+ testCase, 2,
+ (database, transaction) => {
+ const store = transaction.objectStore('books');
+ const index = store.index('by_author');
+ store.deleteIndex('by_title');
+ index.name = 'by_title';
+ assert_array_equals(
+ store.indexNames, ['by_title'],
+ 'IDBObjectStore.indexNames should immediately reflect the rename');
+ }))
+ .then(database => {
+ const transaction = database.transaction('books', 'readonly');
+ const store = transaction.objectStore('books');
+ assert_array_equals(
+ store.indexNames, ['by_title'],
+ 'IDBObjectStore.indexNames should still reflect the rename after ' +
+ 'the versionchange transaction commits');
+ const index = store.index('by_title');
+ return checkAuthorIndexContents(
+ testCase, index,
+ 'Renaming an index should not change its contents')
+ .then(() => database.close());
+ });
+}, 'IndexedDB index rename to the name of a deleted index succeeds');
+
+promise_test(testCase => {
+ return createDatabase(
+ testCase,
+ (database, transaction) => {
+ createBooksStore(testCase, database);
+ })
+ .then(database => {
+ database.close();
+ })
+ .then(
+ () => migrateDatabase(
+ testCase, 2,
+ (database, transaction) => {
+ const store = transaction.objectStore('books');
+ store.index('by_author').name = 'tmp';
+ store.index('by_title').name = 'by_author';
+ store.index('tmp').name = 'by_title';
+ assert_array_equals(
+ store.indexNames, ['by_author', 'by_title'],
+ 'IDBObjectStore.indexNames should reflect the swap immediately ' +
+ 'after the renames');
+ return checkTitleIndexContents(
+ testCase, store.index('by_author'),
+ 'Renaming an index should not change its contents');
+ }))
+ .then(database => {
+ const transaction = database.transaction('books', 'readonly');
+ const store = transaction.objectStore('books');
+ assert_array_equals(
+ store.indexNames, ['by_author', 'by_title'],
+ 'IDBObjectStore.indexNames should still reflect the swap after ' +
+ 'the versionchange transaction commits');
+ const index = store.index('by_title');
+ return checkAuthorIndexContents(
+ testCase, index,
+ 'Renaming an index should not change its contents')
+ .then(() => database.close());
+ });
+}, 'IndexedDB index swapping via renames succeeds');
+
+promise_test(testCase => {
+ return createDatabase(
+ testCase,
+ (database, transaction) => {
+ createBooksStore(testCase, database);
+ })
+ .then(database => {
+ database.close();
+ })
+ .then(
+ () => migrateDatabase(
+ testCase, 2,
+ (database, transaction) => {
+ const store = transaction.objectStore('books');
+ const index = store.index('by_author');
+
+ index.name = 42;
+ assert_equals(
+ index.name, '42',
+ 'IDBIndex name should change immediately after a rename to a ' +
+ 'number');
+ assert_array_equals(
+ store.indexNames, ['42', 'by_title'],
+ 'IDBObjectStore.indexNames should immediately reflect the ' +
+ 'stringifying rename');
+
+ index.name = true;
+ assert_equals(
+ index.name, 'true',
+ 'IDBIndex name should change immediately after a rename to a ' +
+ 'boolean');
+
+ index.name = {};
+ assert_equals(
+ index.name, '[object Object]',
+ 'IDBIndex name should change immediately after a rename to an ' +
+ 'object');
+
+ index.name = () => null;
+ assert_equals(
+ index.name, '() => null',
+ 'IDBIndex name should change immediately after a rename to a ' +
+ 'function');
+
+ index.name = undefined;
+ assert_equals(
+ index.name, 'undefined',
+ 'IDBIndex name should change immediately after a rename to ' +
+ 'undefined');
+ }))
+ .then(database => {
+ const transaction = database.transaction('books', 'readonly');
+ const store = transaction.objectStore('books');
+ assert_array_equals(
+ store.indexNames, ['by_title', 'undefined'],
+ 'IDBObjectStore.indexNames should reflect the last rename ' +
+ 'after the versionchange transaction commits');
+ const index = store.index('undefined');
+ return checkAuthorIndexContents(
+ testCase, index,
+ 'Renaming an index should not change its contents')
+ .then(() => database.close());
+ });
+}, 'IndexedDB index rename stringifies non-string names');
+
+for (let escapedName of ['', '\\u0000', '\\uDC00\\uD800'])
+ ((escapedName) => {
+ const name = JSON.parse('"' + escapedName + '"');
+ promise_test(testCase => {
+ return createDatabase(
+ testCase,
+ (database, transaction) => {
+ createBooksStore(testCase, database);
+ })
+ .then(database => {
+ database.close();
+ })
+ .then(
+ () => migrateDatabase(
+ testCase, 2,
+ (database, transaction) => {
+ const store = transaction.objectStore('books');
+ const index = store.index('by_author');
+
+ index.name = name;
+ assert_equals(
+ index.name, name,
+ 'IDBIndex name should change immediately after the rename');
+ assert_array_equals(
+ store.indexNames, [name, 'by_title'].sort(),
+ 'IDBObjectStore.indexNames should immediately reflect the rename');
+ }))
+ .then(database => {
+ const transaction = database.transaction('books', 'readonly');
+ const store = transaction.objectStore('books');
+ assert_array_equals(
+ store.indexNames, [name, 'by_title'].sort(),
+ 'IDBObjectStore.indexNames should reflect the rename ' +
+ 'after the versionchange transaction commits');
+ const index = store.index(name);
+ return checkAuthorIndexContents(
+ testCase, index,
+ 'Renaming an index should not change its contents')
+ .then(() => database.close());
+ });
+ }, 'IndexedDB index can be renamed to "' + escapedName + '"');
+ })(escapedName);
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.sharedworker.html
new file mode 100644
index 00000000000..8d267f306f3
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.sharedworker.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: index renaming support</title>
+<meta name="timeout" content="long">
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/idbindex-rename.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.worker.html
new file mode 100644
index 00000000000..5c676fec956
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.worker.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: index renaming support</title>
+<meta name="timeout" content="long">
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/idbindex-rename.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.worker.js
new file mode 100644
index 00000000000..653eb81d14d
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbindex-rename.any.worker.js
@@ -0,0 +1,11 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "IndexedDB: index renaming support";
+importScripts("resources/support-promises.js")
+importScripts("/IndexedDB/idbindex-rename.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.html
new file mode 100644
index 00000000000..3c40bb912af
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBRequest.error</title>
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/idbrequest_error.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.js
new file mode 100644
index 00000000000..2614db60fb2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.js
@@ -0,0 +1,24 @@
+// META: title=IDBRequest.error
+// META: global=window,worker
+// META: script=resources/support.js
+
+'use strict';
+
+async_test(t => {
+ let open = createdb(t);
+ open.onupgradeneeded = t.step_func(e => {
+ let db = e.target.result;
+ db.createObjectStore('store');
+ });
+ open.onsuccess = t.step_func(e => {
+ let db = e.target.result;
+ let request =
+ db.transaction('store', 'readonly').objectStore('store').get(0);
+
+ assert_equals(request.readyState, 'pending');
+ assert_throws_dom(
+ 'InvalidStateError', () => request.error,
+ 'IDBRequest.error should throw if request is pending');
+ t.done();
+ });
+}, 'IDBRequest.error throws if ready state is pending');
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.sharedworker.html
new file mode 100644
index 00000000000..4e6b95c9169
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.sharedworker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBRequest.error</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/idbrequest_error.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.worker.html
new file mode 100644
index 00000000000..0a6985cd5f8
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IDBRequest.error</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/idbrequest_error.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.worker.js
new file mode 100644
index 00000000000..32e20e7bf5c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbrequest_error.any.worker.js
@@ -0,0 +1,11 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "IDBRequest.error";
+importScripts("resources/support.js")
+importScripts("/IndexedDB/idbrequest_error.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.sharedworker.html
new file mode 100644
index 00000000000..b0010ac0b01
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.sharedworker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: IDBTransaction.objectStoreNames attribute</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/idbtransaction_objectStoreNames.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.html
new file mode 100644
index 00000000000..488443fdc75
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: IDBTransaction.objectStoreNames attribute</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/idbtransaction_objectStoreNames.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.js
new file mode 100644
index 00000000000..2f4da4a6046
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.worker.js
@@ -0,0 +1,11 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "IndexedDB: IDBTransaction.objectStoreNames attribute";
+importScripts("resources/support.js")
+importScripts("/IndexedDB/idbtransaction_objectStoreNames.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.html
new file mode 100644
index 00000000000..b70afcfd6e5
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Bubbling and capturing of request events</title>
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support-promises.js"></script>
+<script src="resources/support.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/request_bubble-and-capture.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.js
new file mode 100644
index 00000000000..c80d7f5fd5c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.js
@@ -0,0 +1,70 @@
+// META: title=Bubbling and capturing of request events
+// META: global=window,worker
+// META: script=resources/support-promises.js
+// META: script=resources/support.js
+
+'use strict';
+
+async_test(t => {
+ let events = [];
+
+ let open_rq = createdb(t);
+ open_rq.onupgradeneeded =
+ function(e) {
+ let db = e.target.result;
+ let txn = e.target.transaction;
+ let store = db.createObjectStore('s');
+ let rq1 = store.add('', 1);
+ let rq2 = store.add('', 1);
+ db.onerror = function() {};
+
+ log_request(' db', db);
+ log_request('txn', txn);
+ log_request('rq1', rq1);
+ log_request('rq2', rq2);
+
+ // Don't let it get to abort
+ db.addEventListener('error', function(e) {
+ e.preventDefault()
+ }, false);
+ }
+
+ open_rq.onsuccess =
+ function(e) {
+ log('open_rq.success')(e);
+ assert_array_equals(
+ events,
+ [
+ 'capture db.success', 'capture txn.success', 'capture rq1.success',
+ 'bubble rq1.success',
+
+ 'capture db.error: ConstraintError',
+ 'capture txn.error: ConstraintError',
+ 'capture rq2.error: ConstraintError',
+ 'bubble rq2.error: ConstraintError',
+ 'bubble txn.error: ConstraintError',
+ 'bubble db.error: ConstraintError',
+
+ 'open_rq.success'
+ ],
+ 'events');
+ t.done();
+ }
+
+
+ function log_request(type, obj) {
+ obj.addEventListener('success', log('capture ' + type + '.success'), true);
+ obj.addEventListener('success', log('bubble ' + type + '.success'), false);
+ obj.addEventListener('error', log('capture ' + type + '.error'), true);
+ obj.addEventListener('error', log('bubble ' + type + '.error'), false);
+ }
+
+ function log(msg) {
+ return function(e) {
+ if (e && e.target && e.target.error)
+ events.push(msg + ': ' + e.target.error.name);
+ else
+ events.push(msg);
+ };
+ }
+}, 'IndexedDB Request Event Propagation: Bubbling and Capturing');
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.html
new file mode 100644
index 00000000000..cf6cd0f7c21
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Bubbling and capturing of request events</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/request_bubble-and-capture.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.html
new file mode 100644
index 00000000000..c6df49549c5
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Bubbling and capturing of request events</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/request_bubble-and-capture.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.js
new file mode 100644
index 00000000000..3635e44a65a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.js
@@ -0,0 +1,12 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "Bubbling and capturing of request events";
+importScripts("resources/support-promises.js")
+importScripts("resources/support.js")
+importScripts("/IndexedDB/request_bubble-and-capture.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.html
new file mode 100644
index 00000000000..d45da850854
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: Test error events fired at requests from aborted transaction</title>
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support-promises.js"></script>
+<script src="resources/support.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/transaction-abort-request-error.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.js
new file mode 100644
index 00000000000..a7ddd02f1d2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.js
@@ -0,0 +1,69 @@
+// META: title=IndexedDB: Test error events fired at requests from aborted transaction
+// META: global=window,worker
+// META: script=resources/support-promises.js
+// META: script=resources/support.js
+
+// Spec: https://w3c.github.io/IndexedDB/#abort-transaction
+
+'use strict';
+
+indexeddb_test(
+ (t, db) => {
+ db.createObjectStore('store');
+ },
+ (t, db) => {
+ const tx = db.transaction('store', 'readonly');
+ const request = tx.objectStore('store').get(0);
+ tx.abort();
+ request.onsuccess = t.unreached_func('request should not succeed');
+
+ let connection_saw_error = false;
+ let transaction_saw_error = false;
+
+ request.onerror = t.step_func(e => {
+ assert_equals(
+ request.readyState, 'done', 'Request\'s done flag should be set');
+ assert_equals(
+ request.result, undefined, 'Request\'s result should be undefined');
+ assert_equals(
+ request.error.name, 'AbortError',
+ 'Request\'s error should be AbortError');
+
+ assert_equals(e.target, request, 'event target should be request');
+ assert_equals(e.type, 'error', 'Event type should be error');
+ assert_true(e.bubbles, 'Event should bubble');
+ assert_true(e.cancelable, 'Event should cancelable');
+
+ assert_true(
+ connection_saw_error, 'Event propagated through connection');
+ assert_true(
+ transaction_saw_error, 'Event propagated through transaction');
+ t.done();
+ });
+
+ // Event propagates via "get the parent" on request and transaction.
+
+ db.addEventListener(
+ 'error', t.step_func(e => {
+ connection_saw_error = true;
+ assert_equals(e.target, request, 'event target should be request');
+ assert_equals(e.type, 'error', 'Event type should be error');
+ assert_true(e.bubbles, 'Event should bubble');
+ assert_true(e.cancelable, 'Event should cancelable');
+ }),
+ true);
+
+ tx.addEventListener(
+ 'error', t.step_func(e => {
+ transaction_saw_error = true;
+ assert_equals(e.target, request, 'event target should be request');
+ assert_equals(e.type, 'error', 'Event type should be error');
+ assert_true(e.bubbles, 'Event should bubble');
+ assert_true(e.cancelable, 'Event should cancelable');
+
+ assert_true(
+ connection_saw_error, 'Event propagated through connection');
+ }),
+ true);
+ },
+ 'Properties of error events fired at requests when aborting a transaction');
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.html
new file mode 100644
index 00000000000..c62bd6e06df
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: Test error events fired at requests from aborted transaction</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/transaction-abort-request-error.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.html
new file mode 100644
index 00000000000..4fa6b45b67c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: Test error events fired at requests from aborted transaction</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/transaction-abort-request-error.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.js
new file mode 100644
index 00000000000..5328d8fa50f
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.js
@@ -0,0 +1,12 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "IndexedDB: Test error events fired at requests from aborted transaction";
+importScripts("resources/support-promises.js")
+importScripts("resources/support.js")
+importScripts("/IndexedDB/transaction-abort-request-error.any.js");
+done();
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.html
new file mode 100644
index 00000000000..ced5bac9a05
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB Transaction Event Bubbling and Capturing</title>
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/support.js"></script>
+<div id=log></div>
+<script src="../IndexedDB/transaction_bubble-and-capture.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.js
new file mode 100644
index 00000000000..9449a756daa
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.js
@@ -0,0 +1,73 @@
+// META: title=IndexedDB Transaction Event Bubbling and Capturing
+// META: global=window,worker
+// META: script=resources/support.js
+
+'use strict';
+
+async_test(t => {
+ let events = [];
+ let open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+ let txn = e.target.transaction;
+ let store = db.createObjectStore('store');
+ let rq1 = store.add('', 1);
+ let rq2 = store.add('', 1);
+
+ // We will run db.error, but don't let that fail the test
+ db.onerror = undefined;
+
+ log_events('db', db, 'success');
+ log_events('db', db, 'error');
+
+ log_events('txn', txn, 'success');
+ log_events('txn', txn, 'error');
+
+ log_events('rq1', rq1, 'success');
+ log_events('rq1', rq1, 'error');
+
+ log_events('rq2', rq2, 'success');
+ log_events('rq2', rq2, 'error');
+
+ // Don't let it get to abort
+ db.addEventListener('error', function(e) {
+ e.preventDefault();
+ }, false);
+ };
+
+ open_rq.onsuccess = function(e) {
+ log('open_rq.success')(e);
+ assert_array_equals(
+ events,
+ [
+ 'capture db.success',
+ 'capture txn.success',
+ 'capture rq1.success',
+ 'bubble rq1.success',
+
+ 'capture db.error: ConstraintError',
+ 'capture txn.error: ConstraintError',
+ 'capture rq2.error: ConstraintError',
+ 'bubble rq2.error: ConstraintError',
+ 'bubble txn.error: ConstraintError',
+ 'bubble db.error: ConstraintError',
+
+ 'open_rq.success',
+ ],
+ 'events');
+ t.done();
+ };
+ function log_events(type, obj, evt) {
+ obj.addEventListener(evt, log('capture ' + type + '.' + evt), true);
+ obj.addEventListener(evt, log('bubble ' + type + '.' + evt), false);
+ }
+
+ function log(msg) {
+ return function(e) {
+ if (e && e.target && e.target.error)
+ events.push(msg + ': ' + e.target.error.name);
+ else
+ events.push(msg);
+ };
+ }
+}, 'Capture and bubble');
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.html
new file mode 100644
index 00000000000..0b3a4f7e545
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB Transaction Event Bubbling and Capturing</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new SharedWorker("../IndexedDB/transaction_bubble-and-capture.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.html
new file mode 100644
index 00000000000..abe23845b26
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB Transaction Event Bubbling and Capturing</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+fetch_tests_from_worker(new Worker("../IndexedDB/transaction_bubble-and-capture.any.worker.js"));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.js
new file mode 100644
index 00000000000..fb82436e774
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.js
@@ -0,0 +1,11 @@
+
+self.GLOBAL = {
+ isWindow: function() { return false; },
+ isWorker: function() { return true; },
+ isShadowRealm: function() { return false; },
+};
+importScripts("/resources/testharness.js");
+self.META_TITLE = "IndexedDB Transaction Event Bubbling and Capturing";
+importScripts("resources/support.js")
+importScripts("/IndexedDB/transaction_bubble-and-capture.any.js");
+done();