LibWeb/IDB: Dont include databases with version 0 in databases()

This commit is contained in:
stelar7 2025-04-25 09:13:52 +02:00 committed by Tim Flynn
commit d28a4434d0
Notes: github-actions[bot] 2025-04-25 11:24:39 +00:00

View file

@ -211,11 +211,17 @@ GC::Ref<WebIDL::Promise> IDBFactory::databases()
for (u32 i = 0; i < databases.size(); ++i) {
auto& db = databases[i];
// 1. Let info be a new IDBDatabaseInfo dictionary.
// 2. Set infos name dictionary member to dbs name.
// 3. Set infos version dictionary member to dbs version.
// 1. If dbs version is 0, then continue.
if (db->version() == 0)
continue;
// 2. Let info be a new IDBDatabaseInfo dictionary.
auto info = JS::Object::create(realm, realm.intrinsics().object_prototype());
// 3. Set infos name dictionary member to dbs name.
MUST(info->create_data_property("name"_fly_string, JS::PrimitiveString::create(realm.vm(), db->name())));
// 4. Set infos version dictionary member to dbs version.
MUST(info->create_data_property("version"_fly_string, JS::Value(db->version())));
// 4. Append info to result.