LibWeb: Close the database if the upgrade connection is aborted

This commit is contained in:
stelar7 2024-12-01 22:52:33 +01:00 committed by Jelle Raaijmakers
commit a25bba27fa
Notes: github-actions[bot] 2024-12-14 22:04:06 +00:00
4 changed files with 20 additions and 8 deletions

View file

@ -37,11 +37,13 @@ public:
[[nodiscard]] GC::Ref<IDBDatabase> connection() const { return m_connection; }
[[nodiscard]] Bindings::IDBTransactionDurability durability() const { return m_durability; }
[[nodiscard]] GC::Ptr<IDBRequest> associated_request() const { return m_associated_request; }
[[nodiscard]] bool aborted() const { return m_aborted; }
void set_mode(Bindings::IDBTransactionMode mode) { m_mode = mode; }
void set_state(TransactionState state) { m_state = state; }
void set_error(GC::Ptr<WebIDL::DOMException> error) { m_error = error; }
void set_associated_request(GC::Ptr<IDBRequest> request) { m_associated_request = request; }
void set_aborted(bool aborted) { m_aborted = aborted; }
[[nodiscard]] bool is_upgrade_transaction() const { return m_mode == Bindings::IDBTransactionMode::Versionchange; }
[[nodiscard]] bool is_readonly() const { return m_mode == Bindings::IDBTransactionMode::Readonly; }
@ -69,5 +71,6 @@ private:
GC::Ptr<WebIDL::DOMException> m_error;
GC::Ptr<IDBRequest> m_associated_request;
bool m_aborted { false };
};
}