mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-15 05:22:04 +00:00
LibWeb/IDB: Implement clear_an_object_store
This commit is contained in:
parent
aa35ced34f
commit
637f35c0eb
Notes:
github-actions[bot]
2025-05-08 13:14:26 +00:00
Author: https://github.com/stelar7
Commit: 637f35c0eb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4650
Reviewed-by: https://github.com/AtkinsSJ ✅
6 changed files with 28 additions and 0 deletions
|
@ -1840,4 +1840,19 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
|
|||
return cursor;
|
||||
}
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#clear-an-object-store
|
||||
JS::Value clear_an_object_store(GC::Ref<ObjectStore> store)
|
||||
{
|
||||
// 1. Remove all records from store.
|
||||
store->clear_records();
|
||||
|
||||
// 2. In all indexes which reference store, remove all records.
|
||||
for (auto const& [name, index] : store->index_set()) {
|
||||
index->clear_records();
|
||||
}
|
||||
|
||||
// 3. Return undefined.
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue