mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb/IDB: Add ObjectStore to IDBDatabases store set
This commit is contained in:
parent
1fc2d6f1af
commit
f1fba24538
Notes:
github-actions[bot]
2025-04-09 17:49:49 +00:00
Author: https://github.com/stelar7
Commit: f1fba24538
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4178
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/AtkinsSJ
2 changed files with 4 additions and 0 deletions
|
@ -136,6 +136,9 @@ WebIDL::ExceptionOr<GC::Ref<IDBObjectStore>> IDBDatabase::create_object_store(St
|
||||||
// If keyPath is not null, set the created object store's key path to keyPath.
|
// 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);
|
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.
|
// 10. Return a new object store handle associated with store and transaction.
|
||||||
return IDBObjectStore::create(realm, object_store, *transaction);
|
return IDBObjectStore::create(realm, object_store, *transaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
[[nodiscard]] ConnectionState state() const { return m_state; }
|
[[nodiscard]] ConnectionState state() const { return m_state; }
|
||||||
[[nodiscard]] GC::Ref<Database> associated_database() { return m_associated_database; }
|
[[nodiscard]] GC::Ref<Database> associated_database() { return m_associated_database; }
|
||||||
[[nodiscard]] ReadonlySpan<GC::Ref<ObjectStore>> object_store_set() { return m_object_store_set; }
|
[[nodiscard]] ReadonlySpan<GC::Ref<ObjectStore>> object_store_set() { return m_object_store_set; }
|
||||||
|
void add_to_object_store_set(GC::Ref<ObjectStore> object_store) { m_object_store_set.append(object_store); }
|
||||||
void remove_from_object_store_set(GC::Ref<ObjectStore> object_store)
|
void remove_from_object_store_set(GC::Ref<ObjectStore> object_store)
|
||||||
{
|
{
|
||||||
m_object_store_set.remove_first_matching([&](auto& entry) { return entry == object_store; });
|
m_object_store_set.remove_first_matching([&](auto& entry) { return entry == object_store; });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue