LibWeb/IDB: Implement IDBTransaction::commit

This commit is contained in:
stelar7 2025-04-09 23:11:12 +02:00 committed by Andrew Kaster
commit da56c1b1eb
Notes: github-actions[bot] 2025-04-11 01:14:15 +00:00
5 changed files with 77 additions and 1 deletions

View file

@ -103,4 +103,19 @@ GC::Ref<HTML::DOMStringList> IDBTransaction::object_store_names()
return create_a_sorted_name_list(realm(), names);
}
// https://w3c.github.io/IndexedDB/#dom-idbtransaction-commit
WebIDL::ExceptionOr<void> IDBTransaction::commit()
{
auto& realm = this->realm();
// 1. If this's state is not active, then throw an "InvalidStateError" DOMException.
if (m_state != TransactionState::Active)
return WebIDL::InvalidStateError::create(realm, "Transaction is not active while commiting"_string);
// 2. Run commit a transaction with this.
commit_a_transaction(realm, *this);
return {};
}
}