LibWeb/IDB: Implement count_the_records_in_a_range

This commit is contained in:
stelar7 2025-04-28 15:51:35 +02:00 committed by Jelle Raaijmakers
parent 64d251b36c
commit 694375d3ac
Notes: github-actions[bot] 2025-04-29 15:07:58 +00:00
4 changed files with 22 additions and 0 deletions

View file

@ -1448,4 +1448,14 @@ WebIDL::ExceptionOr<GC::Ref<IDBKeyRange>> convert_a_value_to_a_key_range(JS::Rea
return IDBKeyRange::create(realm, key, key, false, false);
}
// https://w3c.github.io/IndexedDB/#count-the-records-in-a-range
JS::Value count_the_records_in_a_range(GC::Ref<ObjectStore> source, GC::Ref<IDBKeyRange> range)
{
// 1. Let count be the number of records, if any, in sources list of records with key in range.
auto count = source->count_records_in_range(range);
// 2. Return count.
return JS::Value(count);
}
}