mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibWeb/IDB: Fillout IDBIndex attributes
This commit is contained in:
parent
9321ad04c0
commit
a235dd4300
Notes:
github-actions[bot]
2025-04-09 17:50:51 +00:00
Author: https://github.com/stelar7
Commit: a235dd4300
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4178
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/AtkinsSJ
3 changed files with 101 additions and 10 deletions
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include <LibGC/Heap.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/IndexedDB/IDBObjectStore.h>
|
||||
#include <LibWeb/IndexedDB/Internal/Index.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
|
@ -18,11 +20,32 @@ class IDBIndex : public Bindings::PlatformObject {
|
|||
|
||||
public:
|
||||
virtual ~IDBIndex() override;
|
||||
[[nodiscard]] static GC::Ref<IDBIndex> create(JS::Realm&);
|
||||
[[nodiscard]] static GC::Ref<IDBIndex> create(JS::Realm&, GC::Ref<Index>, GC::Ref<IDBObjectStore>);
|
||||
|
||||
WebIDL::ExceptionOr<void> set_name(String const& value);
|
||||
String name() const { return m_name; }
|
||||
GC::Ref<IDBObjectStore> object_store() { return m_object_store_handle; }
|
||||
JS::Value key_path() const;
|
||||
bool multi_entry() const { return m_index->multi_entry(); }
|
||||
bool unique() const { return m_index->unique(); }
|
||||
|
||||
// The transaction of an index handle is the transaction of its associated object store handle.
|
||||
GC::Ref<IDBTransaction> transaction() { return m_object_store_handle->transaction(); }
|
||||
GC::Ref<Index> index() { return m_index; }
|
||||
GC::Ref<IDBObjectStore> store() { return m_object_store_handle; }
|
||||
|
||||
protected:
|
||||
explicit IDBIndex(JS::Realm&);
|
||||
explicit IDBIndex(JS::Realm&, GC::Ref<Index>, GC::Ref<IDBObjectStore>);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Visitor& visitor) override;
|
||||
|
||||
private:
|
||||
// An index handle has an associated index and an associated object store handle.
|
||||
GC::Ref<Index> m_index;
|
||||
GC::Ref<IDBObjectStore> m_object_store_handle;
|
||||
|
||||
// An index handle has a name, which is initialized to the name of the associated index when the index handle is created.
|
||||
String m_name;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue