LibWeb/IDB: Implement iterate_a_cursor

This commit is contained in:
stelar7 2025-04-29 17:37:16 +02:00 committed by Jelle Raaijmakers
commit 98d08b27e4
Notes: github-actions[bot] 2025-05-06 09:18:19 +00:00
7 changed files with 391 additions and 1 deletions

View file

@ -101,4 +101,19 @@ JS::Value IDBIndex::key_path() const
});
}
// https://w3c.github.io/IndexedDB/#index-referenced-value
HTML::SerializationRecord IDBIndex::get_referenced_value(IndexRecord const& index_record) const
{
// Records in an index are said to have a referenced value.
// This is the value of the record in the indexs referenced object store which has a key equal to the indexs records value.
return m_index
->object_store()
->records()
.first_matching([&](auto const& store_record) {
return Key::equals(store_record.key, index_record.value);
})
.value()
.value;
}
}