indexeddb: Allow deleting unknown DBs. (#38076)

The current behaviour is too strict according to the spec and is the
cause of many intermittent test errors.

Testing: Existing coverage is sufficient.
Fixes: #37706

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-07-15 21:22:18 -04:00 committed by GitHub
parent 30b6e289e0
commit 189e649222
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 19 additions and 26 deletions

View file

@ -297,11 +297,17 @@ impl IndexedDBManager {
} }
}, },
SyncOperation::DeleteDatabase(sender, origin, db_name) => { SyncOperation::DeleteDatabase(sender, origin, db_name) => {
// https://w3c.github.io/IndexedDB/#delete-a-database
// Step 4. Let db be the database named name in storageKey,
// if one exists. Otherwise, return 0 (zero).
let idb_description = IndexedDBDescription { let idb_description = IndexedDBDescription {
origin, origin,
name: db_name, name: db_name,
}; };
self.databases.remove(&idb_description); if self.databases.remove(&idb_description).is_none() {
let _ = sender.send(Ok(()));
return;
}
// FIXME:(rasviitanen) Possible security issue? // FIXME:(rasviitanen) Possible security issue?
// FIXME:(arihant2math) using remove_dir_all with arbitrary input ... // FIXME:(arihant2math) using remove_dir_all with arbitrary input ...

View file

@ -1,13 +1,12 @@
[database-names-by-origin.html] [database-names-by-origin.html]
expected: TIMEOUT
[open database names don't leak to cross-origin iframe] [open database names don't leak to cross-origin iframe]
expected: TIMEOUT expected: FAIL
[open database names don't leak to cross-origin window] [open database names don't leak to cross-origin window]
expected: NOTRUN expected: FAIL
[closed database names don't leak to cross-origin iframe] [closed database names don't leak to cross-origin iframe]
expected: NOTRUN expected: FAIL
[closed database names don't leak to cross-origin window] [closed database names don't leak to cross-origin window]
expected: NOTRUN expected: FAIL

View file

@ -1,4 +1,5 @@
[idb-binary-key-detached.any.html] [idb-binary-key-detached.any.html]
expected: CRASH
[Detached ArrayBuffers must throw DataError when used as a key] [Detached ArrayBuffers must throw DataError when used as a key]
expected: FAIL expected: FAIL
@ -7,6 +8,7 @@
[idb-binary-key-detached.any.worker.html] [idb-binary-key-detached.any.worker.html]
expected: CRASH
[Detached ArrayBuffers must throw DataError when used as a key] [Detached ArrayBuffers must throw DataError when used as a key]
expected: FAIL expected: FAIL

View file

@ -11,18 +11,12 @@
[Empty name] [Empty name]
expected: FAIL expected: FAIL
[Attempting to create an existing object store with a different keyPath throw ConstraintError ]
expected: FAIL
[Object store 'name' and 'keyPath' properties are correctly set ] [Object store 'name' and 'keyPath' properties are correctly set ]
expected: FAIL expected: FAIL
[Attempt to create an object store outside of a version change transaction ] [Attempt to create an object store outside of a version change transaction ]
expected: FAIL expected: FAIL
[Attempt to create an object store that already exists ]
expected: FAIL
[Attempt to create an object store with an invalid key path ] [Attempt to create an object store with an invalid key path ]
expected: FAIL expected: FAIL
@ -40,18 +34,12 @@
[Empty name] [Empty name]
expected: FAIL expected: FAIL
[Attempting to create an existing object store with a different keyPath throw ConstraintError ]
expected: FAIL
[Object store 'name' and 'keyPath' properties are correctly set ] [Object store 'name' and 'keyPath' properties are correctly set ]
expected: FAIL expected: FAIL
[Attempt to create an object store outside of a version change transaction ] [Attempt to create an object store outside of a version change transaction ]
expected: FAIL expected: FAIL
[Attempt to create an object store that already exists ]
expected: FAIL
[Attempt to create an object store with an invalid key path ] [Attempt to create an object store with an invalid key path ]
expected: FAIL expected: FAIL

View file

@ -1,15 +1,9 @@
[idbfactory-deleteDatabase-request-success.any.worker.html] [idbfactory-deleteDatabase-request-success.any.worker.html]
[IDBFactory deleteDatabase() request properties on success]
expected: FAIL
[idbfactory-deleteDatabase-request-success.any.serviceworker.html] [idbfactory-deleteDatabase-request-success.any.serviceworker.html]
expected: ERROR expected: ERROR
[idbfactory-deleteDatabase-request-success.any.html] [idbfactory-deleteDatabase-request-success.any.html]
[IDBFactory deleteDatabase() request properties on success]
expected: FAIL
[idbfactory-deleteDatabase-request-success.any.sharedworker.html] [idbfactory-deleteDatabase-request-success.any.sharedworker.html]
expected: ERROR expected: ERROR

View file

@ -1,4 +1,5 @@
[idbrequest-onupgradeneeded.any.worker.html] [idbrequest-onupgradeneeded.any.worker.html]
expected: TIMEOUT
[indexedDB.delete called from upgradeneeded handler] [indexedDB.delete called from upgradeneeded handler]
expected: FAIL expected: FAIL
@ -9,10 +10,11 @@
expected: FAIL expected: FAIL
[transaction oncomplete ordering relative to open request onsuccess] [transaction oncomplete ordering relative to open request onsuccess]
expected: FAIL expected: TIMEOUT
[idbrequest-onupgradeneeded.any.html] [idbrequest-onupgradeneeded.any.html]
expected: TIMEOUT
[indexedDB.delete called from upgradeneeded handler] [indexedDB.delete called from upgradeneeded handler]
expected: FAIL expected: FAIL
@ -23,7 +25,7 @@
expected: FAIL expected: FAIL
[transaction oncomplete ordering relative to open request onsuccess] [transaction oncomplete ordering relative to open request onsuccess]
expected: FAIL expected: TIMEOUT
[idbrequest-onupgradeneeded.any.serviceworker.html] [idbrequest-onupgradeneeded.any.serviceworker.html]

View file

@ -5,10 +5,12 @@
expected: ERROR expected: ERROR
[historical.any.worker.html] [historical.any.worker.html]
expected: CRASH
[historical] [historical]
expected: FAIL expected: FAIL
[historical.any.html] [historical.any.html]
expected: CRASH
[historical] [historical]
expected: FAIL expected: FAIL