LibWeb: Implement IDBDatabase::close()

This commit is contained in:
stelar7 2024-11-07 20:33:25 +01:00 committed by Jelle Raaijmakers
commit bb31b682a5
Notes: github-actions[bot] 2024-11-26 13:52:06 +00:00
4 changed files with 27 additions and 1 deletions

View file

@ -10,6 +10,7 @@
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/DOMStringList.h>
#include <LibWeb/IndexedDB/IDBRequest.h>
#include <LibWeb/IndexedDB/Internal/Algorithms.h>
#include <LibWeb/IndexedDB/Internal/Database.h>
#include <LibWeb/StorageAPI/StorageKey.h>
@ -35,6 +36,7 @@ public:
void set_version(u64 version) { m_version = version; }
void set_close_pending(bool close_pending) { m_close_pending = close_pending; }
void set_state(ConnectionState state) { m_state = state; }
[[nodiscard]] GC::Ref<HTML::DOMStringList> object_store_names() { return m_object_store_names; }
[[nodiscard]] String name() const { return m_name; }
@ -43,6 +45,13 @@ public:
[[nodiscard]] ConnectionState state() const { return m_state; }
[[nodiscard]] GC::Ref<Database> associated_database() { return m_associated_database; }
// https://w3c.github.io/IndexedDB/#dom-idbdatabase-close
void close()
{
// 1. Run close a database connection with this connection.
close_a_database_connection(*this);
}
void set_onabort(WebIDL::CallbackType*);
WebIDL::CallbackType* onabort();
void set_onclose(WebIDL::CallbackType*);