From 0bdb23571aa08b6b7ba56506ed25700de4ba8081 Mon Sep 17 00:00:00 2001 From: stelar7 Date: Wed, 2 Apr 2025 11:14:50 +0200 Subject: [PATCH] LibWeb/IDB: Add ObjectStore to IDBDatabases store set --- Libraries/LibWeb/IndexedDB/IDBDatabase.cpp | 3 +++ Libraries/LibWeb/IndexedDB/IDBDatabase.h | 1 + 2 files changed, 4 insertions(+) diff --git a/Libraries/LibWeb/IndexedDB/IDBDatabase.cpp b/Libraries/LibWeb/IndexedDB/IDBDatabase.cpp index 99afae48d30..781136c3b35 100644 --- a/Libraries/LibWeb/IndexedDB/IDBDatabase.cpp +++ b/Libraries/LibWeb/IndexedDB/IDBDatabase.cpp @@ -136,6 +136,9 @@ WebIDL::ExceptionOr> IDBDatabase::create_object_store(St // If keyPath is not null, set the created object store's key path to keyPath. auto object_store = ObjectStore::create(realm, database, name, auto_increment, key_path); + // AD-HOC: Add newly created object store to this's object store set. + add_to_object_store_set(object_store); + // 10. Return a new object store handle associated with store and transaction. return IDBObjectStore::create(realm, object_store, *transaction); } diff --git a/Libraries/LibWeb/IndexedDB/IDBDatabase.h b/Libraries/LibWeb/IndexedDB/IDBDatabase.h index e83e0ad142b..d2127fcfc97 100644 --- a/Libraries/LibWeb/IndexedDB/IDBDatabase.h +++ b/Libraries/LibWeb/IndexedDB/IDBDatabase.h @@ -53,6 +53,7 @@ public: [[nodiscard]] ConnectionState state() const { return m_state; } [[nodiscard]] GC::Ref associated_database() { return m_associated_database; } [[nodiscard]] ReadonlySpan> object_store_set() { return m_object_store_set; } + void add_to_object_store_set(GC::Ref object_store) { m_object_store_set.append(object_store); } void remove_from_object_store_set(GC::Ref object_store) { m_object_store_set.remove_first_matching([&](auto& entry) { return entry == object_store; });