LibWeb/IDB: Implement retrieve_multiple_values_from_an_object_store

This commit is contained in:
stelar7 2025-05-08 23:36:18 +02:00 committed by Shannon Booth
commit ddaae635ac
Notes: github-actions[bot] 2025-05-12 20:29:36 +00:00
4 changed files with 49 additions and 0 deletions

View file

@ -89,4 +89,18 @@ void ObjectStore::clear_records()
m_records.clear();
}
GC::ConservativeVector<Record> ObjectStore::first_n_in_range(GC::Ref<IDBKeyRange> range, Optional<WebIDL::UnsignedLong> count)
{
GC::ConservativeVector<Record> records(range->heap());
for (auto const& record : m_records) {
if (range->is_in_range(record.key))
records.append(record);
if (count.has_value() && records.size() >= *count)
break;
}
return records;
}
}