mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Implement IDBTransaction::abort
This commit is contained in:
committed by
Jelle Raaijmakers
parent
2954278e37
commit
7c3f44282d
Notes:
github-actions[bot]
2024-12-14 22:04:18 +00:00
Author: https://github.com/stelar7 Commit: https://github.com/LadybirdBrowser/ladybird/commit/7c3f44282d5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2696 Reviewed-by: https://github.com/gmta
@@ -7,6 +7,7 @@
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/IndexedDB/IDBTransaction.h>
|
||||
#include <LibWeb/IndexedDB/Internal/Algorithms.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
@@ -69,4 +70,16 @@ WebIDL::CallbackType* IDBTransaction::onerror()
|
||||
return event_handler_attribute(HTML::EventNames::error);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> IDBTransaction::abort()
|
||||
{
|
||||
// 1. If this's state is committing or finished, then throw an "InvalidStateError" DOMException.
|
||||
if (m_state == TransactionState::Committing || m_state == TransactionState::Finished)
|
||||
return WebIDL::InvalidStateError::create(realm(), "Transaction is ending"_string);
|
||||
|
||||
// 2. Set this's state to inactive and run abort a transaction with this and null.
|
||||
m_state = TransactionState::Inactive;
|
||||
abort_a_transaction(*this, nullptr);
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user