Skip to content

Conversation

SteveBeckerMSFT
Copy link
Collaborator

@SteveBeckerMSFT SteveBeckerMSFT commented Jun 24, 2025

Closes #206 #130

The following tasks have been completed:

  • Confirmed there are no ReSpec/BikeShed errors or warnings.
  • Modified Web platform tests (link to pull request)

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

@SteveBeckerMSFT SteveBeckerMSFT requested a review from stelar7 June 24, 2025 23:50
@SteveBeckerMSFT SteveBeckerMSFT changed the title Add getAllRecords() method and update getAll()/getAllKeys to support direction option Add getAllRecords() method and update getAll()/getAllKeys() to support direction option Jun 25, 2025
@SteveBeckerMSFT SteveBeckerMSFT linked an issue Jun 25, 2025 that may be closed by this pull request
@SteveBeckerMSFT SteveBeckerMSFT self-assigned this Jun 25, 2025
Copy link
Contributor

@evanstade evanstade left a 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 :)

aarongable pushed a commit to chromium/chromium that referenced this pull request Jul 1, 2025
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 1, 2025
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 1, 2025
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}
lando-prod-mozilla bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Jul 7, 2025
… 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
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jul 8, 2025
… 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
@stelar7
Copy link
Contributor

stelar7 commented Jul 9, 2025

Just a quick first look, but it seems that getAll and getAllKeys now have almost identical implementations, with the only difference being the parameter passed to retrieve multiple items from an object store.

Would it be worth joining these into a single implementation ala. add or put?
(retrieve_from_objectstore(query_or_options, "value", count))

It could also be used with the new getAllRecords as retrieve_from_objectstore(options, "record", null)

(The same would apply to the Index methods i assume)

i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jul 9, 2025
… 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
@SteveBeckerMSFT
Copy link
Collaborator Author

Thank you everyone for the reviews! If anyone has additional feedback, please create an GitHub issue.

@SteveBeckerMSFT SteveBeckerMSFT merged commit 7c40323 into main Jul 31, 2025
2 checks passed
@SteveBeckerMSFT SteveBeckerMSFT deleted the get_all_records branch July 31, 2025 16:47
github-actions bot added a commit that referenced this pull request Jul 31, 2025
…t direction option (#461) (#206)

SHA: 7c40323
Reason: push, by SteveBeckerMSFT

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@saschanaz
Copy link
Member

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.

@asutherland
Copy link
Collaborator

asutherland commented Aug 3, 2025

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.

@SteveBeckerMSFT
Copy link
Collaborator Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getAll() with both key and value (or index key and primary key) Add descending order for getAll() and getAllKeys()
5 participants