mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb/IDB: Implement IDBCursor::effective_key
This commit is contained in:
parent
f996fb9d80
commit
141093e032
Notes:
github-actions[bot]
2025-05-08 13:14:58 +00:00
Author: https://github.com/stelar7
Commit: 141093e032
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4650
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 15 additions and 0 deletions
|
@ -148,4 +148,18 @@ WebIDL::ExceptionOr<void> IDBCursor::continue_(JS::Value key)
|
|||
return {};
|
||||
}
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#cursor-effective-key
|
||||
[[nodiscard]] GC::Ref<Key> IDBCursor::effective_key() const
|
||||
{
|
||||
return m_source_handle.visit(
|
||||
[&](GC::Ref<IDBObjectStore>) -> GC::Ref<Key> {
|
||||
// If the source of a cursor is an object store, the effective key of the cursor is the cursor’s position
|
||||
return *m_position;
|
||||
},
|
||||
[&](GC::Ref<IDBIndex>) -> GC::Ref<Key> {
|
||||
// If the source of a cursor is an index, the effective key is the cursor’s object store position.
|
||||
return *m_object_store_position;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue