-
Notifications
You must be signed in to change notification settings - Fork 70
Add getAllRecords() method and update getAll()/getAllKeys() to support direction option #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only had a couple minutes to begin on review, but here is a modicum of feedback for now :)
Creates a new WPT test helper function in IndexedDB/resources/support-get-all.js, which runs a get all operation on an object store or index using invalid query keys. Each get all operation must fail to create a request by throwing an exception. The change then updates all get all operation permutations to run this test. The change adds WPTs to support this W3C spec PR: w3c/IndexedDB#461 Bug: 40746016 Change-Id: I86549cd8a2ca46e028174e5f140cb640d5f1efdb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6685595 Reviewed-by: Rahul Singh <rahsin@microsoft.com> Commit-Queue: Steve Becker <stevebe@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1481178}
Creates a new WPT test helper function in IndexedDB/resources/support-get-all.js, which runs a get all operation on an object store or index using invalid query keys. Each get all operation must fail to create a request by throwing an exception. The change then updates all get all operation permutations to run this test. The change adds WPTs to support this W3C spec PR: w3c/IndexedDB#461 Bug: 40746016 Change-Id: I86549cd8a2ca46e028174e5f140cb640d5f1efdb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6685595 Reviewed-by: Rahul Singh <rahsin@microsoft.com> Commit-Queue: Steve Becker <stevebe@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1481178}
Creates a new WPT test helper function in IndexedDB/resources/support-get-all.js, which runs a get all operation on an object store or index using invalid query keys. Each get all operation must fail to create a request by throwing an exception. The change then updates all get all operation permutations to run this test. The change adds WPTs to support this W3C spec PR: w3c/IndexedDB#461 Bug: 40746016 Change-Id: I86549cd8a2ca46e028174e5f140cb640d5f1efdb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6685595 Reviewed-by: Rahul Singh <rahsin@microsoft.com> Commit-Queue: Steve Becker <stevebe@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1481178}
… operations with invalid keys, a=testonly Automatic update from web-platform-tests [IndexedDB] Add WPT coverage for get all operations with invalid keys Creates a new WPT test helper function in IndexedDB/resources/support-get-all.js, which runs a get all operation on an object store or index using invalid query keys. Each get all operation must fail to create a request by throwing an exception. The change then updates all get all operation permutations to run this test. The change adds WPTs to support this W3C spec PR: w3c/IndexedDB#461 Bug: 40746016 Change-Id: I86549cd8a2ca46e028174e5f140cb640d5f1efdb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6685595 Reviewed-by: Rahul Singh <rahsin@microsoft.com> Commit-Queue: Steve Becker <stevebe@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1481178} -- wpt-commits: 0da72ce8b1a202a2c09c135e43785a104b7cf59e wpt-pr: 53514
… operations with invalid keys, a=testonly Automatic update from web-platform-tests [IndexedDB] Add WPT coverage for get all operations with invalid keys Creates a new WPT test helper function in IndexedDB/resources/support-get-all.js, which runs a get all operation on an object store or index using invalid query keys. Each get all operation must fail to create a request by throwing an exception. The change then updates all get all operation permutations to run this test. The change adds WPTs to support this W3C spec PR: w3c/IndexedDB#461 Bug: 40746016 Change-Id: I86549cd8a2ca46e028174e5f140cb640d5f1efdb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6685595 Reviewed-by: Rahul Singh <rahsin@microsoft.com> Commit-Queue: Steve Becker <stevebe@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1481178} -- wpt-commits: 0da72ce8b1a202a2c09c135e43785a104b7cf59e wpt-pr: 53514
Just a quick first look, but it seems that Would it be worth joining these into a single implementation ala. It could also be used with the new (The same would apply to the Index methods i assume) |
… operations with invalid keys, a=testonly Automatic update from web-platform-tests [IndexedDB] Add WPT coverage for get all operations with invalid keys Creates a new WPT test helper function in IndexedDB/resources/support-get-all.js, which runs a get all operation on an object store or index using invalid query keys. Each get all operation must fail to create a request by throwing an exception. The change then updates all get all operation permutations to run this test. The change adds WPTs to support this W3C spec PR: w3c/IndexedDB#461 Bug: 40746016 Change-Id: I86549cd8a2ca46e028174e5f140cb640d5f1efdb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6685595 Reviewed-by: Rahul Singh <rahsin@microsoft.com> Commit-Queue: Steve Becker <stevebe@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1481178} -- wpt-commits: 0da72ce8b1a202a2c09c135e43785a104b7cf59e wpt-pr: 53514
Thank you everyone for the reviews! If anyone has additional feedback, please create an GitHub issue. |
I see only Microsoft people here, shouldn't we make sure each PR has multiple commitments? I'm not sure why this PR checked TBD commitments as fulfilled. |
It looks like it was an oversight to update the root comment to link mozilla/standards-positions#1261 that was filed (and didn't get xref'ed here by github infra?), I indicated I thought we should be positive in mozilla/standards-positions#1261 (comment) and :smaug marked the position as positive. It's possible there's more to do in mozilla standards-positions formally, but it's not obvious to me what should be done. (And I was involved in the underlying issue discussion in #130 (comment) and I believe at TPAC 2024 as well.) Similarly it looks like WebKit/standards-positions#521 provided positive feedback but the root comment was not updated. |
I completed this pull request because I thought we had enough consensus to add getAllRecords() to the working draft. However, feedback welcome! Please create a GitHub issue for any feedback on this PR and I'll investigate. As other implementations emerge, we can continue to iterate on the design where needed by creating more GitHub issues. Thank you everyone for the reviews, feedback and participation thus far. Lastly, stelar7, who reviewed this change, is not from Microsoft. He prototyped getAllRecords() in the Ladybird browser. He has also been providing valuable feedback on the IndexedDB spec while working on its implementation in Ladybird. Thank you stelar7! |
Closes #206 #130
The following tasks have been completed:
WPT coverage:
getAllRecords():
//IndexedDB/idbobjectstore_getAllRecords.tentative.any.js
//IndexedDB/idbindex_getAllRecords.tentative.any.js
getAll()/getAllKey() direction option:
//IndexedDB/idbobjectstore_getAllKeys-options.tentative.any.js
//IndexedDB/idbindex_getAllKeys-options.tentative.any.js
//IndexedDB/idbobjectstore_getAll-options.tentative.any.js
//IndexedDB/idbindex_getAll-options.tentative.any.js
Implementation commitment:
Outline of change:
Potentially valid key range
Added to support overloading getAll()/getAllKeys() with IDBGetAllOptions as the first argument. Preserves existing behavior for key ranges and keys. Avoids parsing the first argument for getAll()/getAllKeys() as a IDBGetAllOptions when the argument is a key range or has a type that could be a valid key (Number, String, Date, ArrayBuffer, or Array).
Record snapshot
Added for the output of getAllRecords(), which includes the record's key, value and primaryKey. For IDBIndex, key is the index key and primaryKey is the record's key. Required because object stores and indexes define different types of records.
getAll()/getAllKeys()
Methods updated to support overload of the first argument, which is either a key range or an IDBGetAllOptions. IDBGetAllOptions adds direction support.
getAllRecords()
New method added to both IDBObjectStore and IDBIndex. Supports IDBGetAllOptions only.
Retrieve multiple items from an object store/index
Algorithm updated to include more inputs: kind and direction. Kind determines the type of output, which is either keys, values or record snaptshots. Direction determines the sorting of the output, which is either ascending or descending.
Preview | Diff