Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b682bbefb0ce663d093ff24a5d3447a36855309d
https://github.com/WebKit/WebKit/commit/b682bbefb0ce663d093ff24a5d3447a36855309d
Author: Rupin Mittal <[email protected]>
Date: 2026-03-26 (Thu, 26 Mar 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-options.any-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-options.any.serviceworker-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-options.any.sharedworker-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-options.any.worker-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions.any-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions.any.serviceworker-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions.any.sharedworker-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions.any.worker-expected.txt
M Source/WebCore/Modules/indexeddb/IDBIndex.cpp
M Source/WebCore/Modules/indexeddb/IDBIndex.h
M Source/WebCore/Modules/indexeddb/IDBIndex.idl
M Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
M Source/WebCore/Modules/indexeddb/IDBTransaction.h
M Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
M Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp
M Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h
M Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp
M Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h
M Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.cpp
M Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.h
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
Log Message:
-----------
[IndexedDB API] Support IDBGetAllOptions in IDBIndex::getAllKeys()
https://bugs.webkit.org/show_bug.cgi?id=310700
rdar://173311682
Reviewed by Sihui Liu.
The Indexed API Spec has modified IDBIndex's getAllKeys() function to be able to
take in IDBGetAllOptions
(https://w3c.github.io/IndexedDB/#dom-idbindex-getallkeys).
This means that getAllKeys() now supports specifiying an IDBCursorDirection.
This patch adds support for this.
The first step is to enable getAllKeys() to take in IDBGetAllOptions. We follow:
https://w3c.github.io/IndexedDB/#create-a-request-to-retrieve-multiple-items.
Currently the overload of IDBIndex::getAllKeys which handles non IDBKeyRange
inputs only handles inputs that are a valid IDBKey. IDBGetAllOptions is not.
So follow the spec's steps and update the logic to be:
1. If the input "is a potentially valid key range", convert it to a keyRange
(The current algorithm ends here)
2. If we support IDBGetAllOptions, convert it to an IDBGetAllOptions
3. If that's successful, use the query, count, direction from it
(Need to discern if query is empty, IDBKeyRange, or a regular key)
Since this input parsing must occur after other checks (implemented in
doGetAllKeys) and the input can now contain a count and direction in addition to
a KeyRange, we change doGetAllKeys to take in a new ParsedGetAllQueryOrOptions
object that contains all of these items. In the case where we do have an
IDBGetAllOptions object with a count specified, this count will be used.
The second step is to ensure that the functions later on which actaully return
the records (SQLiteIDBBackingStore::getAllIndexRecords()) receive and use this
direction.
IDBIndex::getAllKeys() will pass this direction to IDBIndex::doGetAllKeys()
which
passes it to IDBTransaction::requestGetAllIndexRecords(). This will capture the
direction in an IDBGetAllRecordsData object. Via this object, the direction is
plumbed all the way down to SQLiteIDBBackingStore::getAllIndexRecords().
This function uses the SQLiteIDBCursor returned by maybeOpenBackingStoreCursor()
to iterate the records. Currently it's hardcoded to use "next". So we update it
to use the direction from the IDBGetAllRecordsData object. This cursor already
knows how to deal with the direction from there.
*
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-options.any-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-options.any.serviceworker-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-options.any.sharedworker-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-options.any.worker-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions.any-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions.any.serviceworker-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions.any.sharedworker-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/key-conversion-exceptions.any.worker-expected.txt:
* Source/WebCore/Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::doGetAll):
Now that IDBTransaction::requestGetAllIndexRecords() takes in a direction,
continue hardcoding "next" for now so behavior is unchanged here.
(WebCore::IDBIndex::doGetAllKeys):
(WebCore::IDBIndex::getAllKeys):
Modify logic to support IDBGetAllOptions based on these steps:
https://w3c.github.io/IndexedDB/#create-a-request-to-retrieve-multiple-items
* Source/WebCore/Modules/indexeddb/IDBIndex.h:
* Source/WebCore/Modules/indexeddb/IDBIndex.idl:
* Source/WebCore/Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
(WebCore::IDBTransaction::requestGetAllIndexRecords):
* Source/WebCore/Modules/indexeddb/IDBTransaction.h:
* Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllIndexRecords):
* Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::maybeCreateBackingStoreCursor):
Take a in a cursor direction and give it to SQLiteIDBCursor.
(WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
Use the passed in cursor direction instead of always using "next".
* Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h:
* Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
(WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenBackingStoreCursor):
Take in a cursor direction and give it to
SQLiteIDBCursor::maybeCreateBackingStoreCursor.
* Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h:
* Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
(WebCore::IDBGetAllRecordsData::isolatedCopy const):
(WebCore::IDBGetAllRecordsData::loggingString const):
* Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.h:
Store a cursor direction.
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Canonical link: https://commits.webkit.org/310051@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications