mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Implement IDBTransaction::abort
This commit is contained in:
parent
2954278e37
commit
7c3f44282d
|
|
@ -7,6 +7,7 @@
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/HTML/EventNames.h>
|
#include <LibWeb/HTML/EventNames.h>
|
||||||
#include <LibWeb/IndexedDB/IDBTransaction.h>
|
#include <LibWeb/IndexedDB/IDBTransaction.h>
|
||||||
|
#include <LibWeb/IndexedDB/Internal/Algorithms.h>
|
||||||
|
|
||||||
namespace Web::IndexedDB {
|
namespace Web::IndexedDB {
|
||||||
|
|
||||||
|
|
@ -69,4 +70,16 @@ WebIDL::CallbackType* IDBTransaction::onerror()
|
||||||
return event_handler_attribute(HTML::EventNames::error);
|
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 {};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ public:
|
||||||
[[nodiscard]] bool is_readonly() const { return m_mode == Bindings::IDBTransactionMode::Readonly; }
|
[[nodiscard]] bool is_readonly() const { return m_mode == Bindings::IDBTransactionMode::Readonly; }
|
||||||
[[nodiscard]] bool is_readwrite() const { return m_mode == Bindings::IDBTransactionMode::Readwrite; }
|
[[nodiscard]] bool is_readwrite() const { return m_mode == Bindings::IDBTransactionMode::Readwrite; }
|
||||||
|
|
||||||
|
WebIDL::ExceptionOr<void> abort();
|
||||||
|
|
||||||
void set_onabort(WebIDL::CallbackType*);
|
void set_onabort(WebIDL::CallbackType*);
|
||||||
WebIDL::CallbackType* onabort();
|
WebIDL::CallbackType* onabort();
|
||||||
void set_oncomplete(WebIDL::CallbackType*);
|
void set_oncomplete(WebIDL::CallbackType*);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user