IDBIndex::getAllRecords() Implementation
Source/WebCore/Modules/indexeddb/IDBRecord.idl
Source/WebCore/bindings/js/JSIDBRecordCustom.cpp
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
IndexedDB in WebKit is implemented across several layers: JS bindings convert internal IDBKeyData/IDBValue types to JS values; the mid-layer (IDBIndex, IDBTransaction) manages requests and communicates results through IDBGetAllResult; the backing store (SQLiteIDBBackingStore) runs SQL queries and populates results; and IPC serialization carries these across process boundaries. This commit implements IDBIndex::getAllRecords() per the W3C spec, returning arrays of IDBRecord objects with key, primaryKey, and value properties.
A critical semantic distinction matters: in the existing Keys/Values cases, the "key" in the result is actually the primary key of the object store record, whereas in the new Records case, "key" is the index key and "primaryKey" is separately the object store record's key — a subtle inversion that must be consistently applied across all layers. The value getter on JSIDBRecord calls deserializeIDBValueWithKeyInjection() to reconstruct in-line-keyed objects at property-access time, the same deserialization path used in JSIDBRequest that has historically been a source of bugs.
JS caller
└─► IDBIndex::getAllRecords(IDBGetAllOptions)
│ doGetAllShared(GetAllType::Records)
▼
IDBTransaction::requestGetAllObjectStoreRecords
│
▼
SQLiteIDBBackingStore::getAllIndexRecords
│ key → index key
│ primaryKey → object store key ← NEW semantics
│ value → serialized IDBValue
▼
IDBGetAllResult { keys[], primaryKeys[], values[] }
│
JSIDBRecord::{key,primaryKey,value} custom getters
└─ value: deserializeIDBValueWithKeyInjection()
Significance
This is new JS-accessible API surface spanning the full IndexedDB stack — JS bindings, IPC serialization, and SQLite backend — each layer introducing new code paths that handle untrusted data.