mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-13 12:31:51 +00:00
LibWeb/IDB: Use helper method for checking transaction mode
This commit is contained in:
parent
c8e1b24864
commit
22a7e0795a
Notes:
github-actions[bot]
2025-05-14 15:18:31 +00:00
Author: https://github.com/stelar7
Commit: 22a7e0795a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4727
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/shannonbooth
1 changed files with 3 additions and 3 deletions
|
@ -75,7 +75,7 @@ WebIDL::ExceptionOr<void> IDBObjectStore::set_name(String const& value)
|
|||
// FIXME: 4. If store has been deleted, throw an "InvalidStateError" DOMException.
|
||||
|
||||
// 5. If transaction is not an upgrade transaction, throw an "InvalidStateError" DOMException.
|
||||
if (transaction->mode() != Bindings::IDBTransactionMode::Versionchange)
|
||||
if (!transaction->is_upgrade_transaction())
|
||||
return WebIDL::InvalidStateError::create(realm, "Attempted to set name outside of version change"_string);
|
||||
|
||||
// 6. If transaction’s state is not active, throw a "TransactionInactiveError" DOMException.
|
||||
|
@ -154,7 +154,7 @@ WebIDL::ExceptionOr<GC::Ref<IDBIndex>> IDBObjectStore::create_index(String const
|
|||
auto store = this->store();
|
||||
|
||||
// 3. If transaction is not an upgrade transaction, throw an "InvalidStateError" DOMException.
|
||||
if (transaction->mode() != Bindings::IDBTransactionMode::Versionchange)
|
||||
if (!transaction->is_upgrade_transaction())
|
||||
return WebIDL::InvalidStateError::create(realm, "Transaction is not an upgrade transaction"_string);
|
||||
|
||||
// FIXME: 4. If store has been deleted, throw an "InvalidStateError" DOMException.
|
||||
|
@ -228,7 +228,7 @@ WebIDL::ExceptionOr<void> IDBObjectStore::delete_index(String const& name)
|
|||
auto store = this->store();
|
||||
|
||||
// 3. If transaction is not an upgrade transaction, throw an "InvalidStateError" DOMException.
|
||||
if (transaction->mode() != Bindings::IDBTransactionMode::Versionchange)
|
||||
if (!transaction->is_upgrade_transaction())
|
||||
return WebIDL::InvalidStateError::create(realm, "Transaction is not an upgrade transaction"_string);
|
||||
|
||||
// FIXME: 4. If store has been deleted, throw an "InvalidStateError" DOMException.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue