-
Notifications
You must be signed in to change notification settings - Fork 71
Adjust how the direction is defaulted in "Creating a request to retrieve multiple items" #478
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
base: main
Are you sure you want to change the base?
Conversation
…eve multiple items"
IDBGetAllOptions is supposed to have a default value for direction. When the value passed is not a potentially valid key range, we need to default the direction argument, and not assume its set Spec issue: w3c/IndexedDB#478
IDBGetAllOptions is supposed to have a default value for direction. When the value passed is not a potentially valid key range, we need to default the direction argument, and not assume its set Spec issue: w3c/IndexedDB#478
Thanks for identifying this issue and proposing a fix. #475 also reported this issue. Maybe we should update "creating a request to retrieve multiple items" to explicitly handle an undefined Prior to
We could update step 8 in "creating a request to retrieve multiple items" to say something like this:
Thoughts? |
This issue is slightly different than the one in #475. {
"query": "a",
"count": 1
} This takes us to step 9.3, where we encounter an |
Thanks for clarifying. For the dictionary without a direction case, I think the default value in the
https://w3c.github.io/IndexedDB/#dictdef-idbgetalloptions See also the WebIDL spec: https://webidl.spec.whatwg.org/#dfn-dictionary-member-default-value |
The |
Any JavaScript object may become an IDBGetAllOptions dictionary when passed into a function like getAllRecords(). Dictionary types do not exist in JavaScript. This looks like the relevant section from the webidl spec: https://webidl.spec.whatwg.org/#js-dictionary You can also see this in action in Chromium's IDBGetAllOptions implementation, which is automatically generated by the V8 bindings code: |
Since the parameter type for There are no steps that say i.e |
Since getAllKeys takes an
any
parameter, we cant be sure that the object we get is of the typeIDBGetAllOptions
. As such, there is no default values applied to the object passed in.If the object passed then doesnt contain direction, we will try to call
retrieve_multiple_items_from_an_XXX
with an undefined value fordirection
. This in turn will result in 0 records being returned. I assume this is not the intention, and as such this PR aims to set the default value of"next"
in those cases.The same would apply to
query
andcount
, but those are explicitly handled to return an unbounded key, and infinite results in other places.Ideally there would be some wording like
"Set direction to queryOrOptions['direction'] if it exists."
, but I'm not sure of the correct spec syntax in these casesThe following tasks have been completed:
Implementation commitment:
Preview | Diff