mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb/IDB: Use helper method for checking transaction state
This commit is contained in:
committed by
Jelle Raaijmakers
parent
4c7c7845d3
commit
c8e1b24864
Notes:
github-actions[bot]
2025-05-14 15:18:37 +00:00
Author: https://github.com/stelar7 Commit: https://github.com/LadybirdBrowser/ladybird/commit/c8e1b248643 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4727 Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/shannonbooth
@@ -108,7 +108,7 @@ WebIDL::ExceptionOr<GC::Ref<IDBObjectStore>> IDBDatabase::create_object_store(St
|
||||
return WebIDL::InvalidStateError::create(realm, "Upgrade transaction is null"_string);
|
||||
|
||||
// 3. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
|
||||
if (transaction->state() != IDBTransaction::TransactionState::Active)
|
||||
if (!transaction->is_active())
|
||||
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.
|
||||
@@ -170,7 +170,7 @@ WebIDL::ExceptionOr<void> IDBDatabase::delete_object_store(String const& name)
|
||||
return WebIDL::InvalidStateError::create(realm, "Upgrade transaction is null"_string);
|
||||
|
||||
// 3. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
|
||||
if (transaction->state() != IDBTransaction::TransactionState::Active)
|
||||
if (!transaction->is_active())
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user