mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Store IndexedDB Databases mappings properly
This commit is contained in:
parent
1656d8fe07
commit
932fb2024e
Notes:
github-actions[bot]
2024-11-26 13:51:43 +00:00
Author: https://github.com/stelar7
Commit: 932fb2024e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2236
Reviewed-by: https://github.com/gmta ✅
2 changed files with 12 additions and 4 deletions
|
@ -52,9 +52,12 @@ ErrorOr<GC::Root<Database>> Database::create_for_key_and_name(JS::Realm& realm,
|
|||
return HashMap<String, GC::Root<Database>>();
|
||||
}));
|
||||
|
||||
return database_mapping.try_ensure(name, [&] {
|
||||
return Database::create(realm, name);
|
||||
});
|
||||
auto value = Database::create(realm, name);
|
||||
|
||||
database_mapping.set(name, value);
|
||||
m_databases.set(key, database_mapping);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
ErrorOr<void> Database::delete_for_key_and_name(StorageAPI::StorageKey& key, String& name)
|
||||
|
@ -73,6 +76,8 @@ ErrorOr<void> Database::delete_for_key_and_name(StorageAPI::StorageKey& key, Str
|
|||
if (!did_remove)
|
||||
return {};
|
||||
|
||||
m_databases.set(key, database_mapping);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue