diff --git a/Libraries/LibWeb/IndexedDB/IDBDatabase.cpp b/Libraries/LibWeb/IndexedDB/IDBDatabase.cpp index 8c1b7c52512..d793f80ef1c 100644 --- a/Libraries/LibWeb/IndexedDB/IDBDatabase.cpp +++ b/Libraries/LibWeb/IndexedDB/IDBDatabase.cpp @@ -109,7 +109,7 @@ WebIDL::ExceptionOr> IDBDatabase::create_object_store(St // 3. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException. if (transaction->state() != IDBTransaction::TransactionState::Active) - return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active"_string); + return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active while creating object store"_string); // 4. Let keyPath be options’s keyPath member if it is not undefined or null, or null otherwise. auto key_path = options.key_path; @@ -171,7 +171,7 @@ WebIDL::ExceptionOr IDBDatabase::delete_object_store(String const& name) // 3. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException. if (transaction->state() != IDBTransaction::TransactionState::Active) - return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active"_string); + return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active while deleting object store"_string); // 4. Let store be the object store named name in database, or throw a "NotFoundError" DOMException if none. auto store = database->object_store_with_name(name); diff --git a/Libraries/LibWeb/IndexedDB/IDBIndex.cpp b/Libraries/LibWeb/IndexedDB/IDBIndex.cpp index c085b8afb15..8d4df08df87 100644 --- a/Libraries/LibWeb/IndexedDB/IDBIndex.cpp +++ b/Libraries/LibWeb/IndexedDB/IDBIndex.cpp @@ -62,7 +62,7 @@ WebIDL::ExceptionOr IDBIndex::set_name(String const& value) // 5. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException. if (transaction->state() != IDBTransaction::TransactionState::Active) - return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active"_string); + return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active while updating index name"_string); // FIXME: 6. If index or index’s object store has been deleted, throw an "InvalidStateError" DOMException. diff --git a/Libraries/LibWeb/IndexedDB/IDBObjectStore.cpp b/Libraries/LibWeb/IndexedDB/IDBObjectStore.cpp index 3564c3c213d..b023f9f121d 100644 --- a/Libraries/LibWeb/IndexedDB/IDBObjectStore.cpp +++ b/Libraries/LibWeb/IndexedDB/IDBObjectStore.cpp @@ -85,7 +85,7 @@ WebIDL::ExceptionOr IDBObjectStore::set_name(String const& value) // 6. If transaction’s state is not active, throw a "TransactionInactiveError" DOMException. if (transaction->state() != IDBTransaction::TransactionState::Active) - return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active"_string); + return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active while updating object store name"_string); // 7. If store’s name is equal to name, terminate these steps. if (store->name() == name) @@ -193,6 +193,8 @@ WebIDL::ExceptionOr> IDBObjectStore::index(String const& name) // https://w3c.github.io/IndexedDB/#dom-idbobjectstore-deleteindex WebIDL::ExceptionOr IDBObjectStore::delete_index(String const& name) { + auto& realm = this->realm(); + // 1. Let transaction be this’s transaction. auto transaction = this->transaction(); @@ -201,18 +203,18 @@ WebIDL::ExceptionOr IDBObjectStore::delete_index(String const& name) // 3. If transaction is not an upgrade transaction, throw an "InvalidStateError" DOMException. if (transaction->mode() != Bindings::IDBTransactionMode::Versionchange) - return WebIDL::InvalidStateError::create(realm(), "Transaction is not an upgrade transaction"_string); + return WebIDL::InvalidStateError::create(realm, "Transaction is not an upgrade transaction"_string); // FIXME: 4. If store has been deleted, throw an "InvalidStateError" DOMException. // 5. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException. if (transaction->state() != IDBTransaction::TransactionState::Active) - return WebIDL::TransactionInactiveError::create(realm(), "Transaction is not active"_string); + return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active while deleting index"_string); // 6. Let index be the index named name in store if one exists, or throw a "NotFoundError" DOMException otherwise. auto index = m_indexes.get(name); if (!index.has_value()) - return WebIDL::NotFoundError::create(realm(), "Index not found"_string); + return WebIDL::NotFoundError::create(realm, "Index not found"_string); // 7. Remove index from this’s index set. m_indexes.remove(name);