- From: Rupin Mittal <notifications@github.com>
- Date: Fri, 03 Apr 2026 19:11:57 -0700
- To: w3c/IndexedDB <IndexedDB@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/IndexedDB/issues/493@github.com>
RupinMittal created an issue (w3c/IndexedDB#493)
(Regarding https://w3c.github.io/IndexedDB/#create-a-request-to-retrieve-multiple-items)
To parse the input and creating a key range out of it, the algorithm has these two steps:
8. If running [is a potentially valid key range](https://w3c.github.io/IndexedDB/#is-a-potentially-valid-key-range) with queryOrOptions is true, then:
- Set range to the result of [converting a value to a key range](https://w3c.github.io/IndexedDB/#convert-a-value-to-a-key-range) with queryOrOptions. Rethrow any exceptions.
- Set direction to "[next](https://w3c.github.io/IndexedDB/#dom-idbcursordirection-next)".
9. Else:
- Set range to the result of [converting a value to a key range](https://w3c.github.io/IndexedDB/#convert-a-value-to-a-key-range) with queryOrOptions["[query](https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-query)"]. Rethrow any exceptions.
- Set count to queryOrOptions["[count](https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-count)"].
- Set direction to queryOrOptions["[direction](https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-direction)"].\
But consider this case in [LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAll.any.js](https://github.com/web-platform-tests/wpt/blob/d1bf16a5383b29e7bc7845cef5f5aa4775936613/IndexedDB/idbindex_getAll.any.js#L28):
```
index_get_all_values_test(
/*storeName=*/ 'out-of-line', /*options=*/ {count: 10}, 'maxCount=10');
```
Here, `queryOrOptions` is undefined/null and the `count` is present. The test expects that we use an unbounded keyRange and return 10 items.
Run the algorithm with this input:
In step 8, [is a potentially valid key range](https://w3c.github.io/IndexedDB/#is-a-potentially-valid-key-range) with queryOrOptions will return false. So we'll proceed to the "else" case where we attempt to access fields of `queryOrOptions`. They will all be undefined/null. So we lose the count and this test should fail. We shouldn't be accessing the fields of an undefined/null value. This is an ill-defined scenario.
Assuming that test is correct (please clarify if it's not), the spec should account for `queryOrOptions` being absent since the IDL says that's allowed: `optional any queryOrOptions`.
Given the expectations of the test, perhaps the spec should have a step before Step 8 that says:
- If `queryOrOptions` is undefined or null:
- Set `range` to be an [unbounded key range](https://w3c.github.io/IndexedDB/#unbounded-key-range) .
- Set direction to "[next](https://w3c.github.io/IndexedDB/#dom-idbcursordirection-next)".
- Else Step 8
- Else Step 9
Another reason (besides the test's expectations) to use an unbounded key range if `queryOrOptions` is undefined or null is that this is what https://w3c.github.io/IndexedDB/#convert-a-value-to-a-key-range does.
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/493
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/IndexedDB/issues/493@github.com>
Received on Saturday, 4 April 2026 02:12:01 UTC