You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
asynchronously execute a request source object confusion #445
In most places this refers to an IDBObjectStore, IDBIndex, or IDBCursor. (handle objects)
However, in IDBCursor::continue step 11, it seems to refer to the "internal" objects (Object Store, and Index)
Since JS is never exposed to "internal" types, having them there seems very odd.
Is this a typo (this’s source -> this) for some of the IDBCursor methods? (advance, continue, continuePrimaryKey)
Or should the methods that create an IDBCursor pass a different object instead?
i.e IDBObjectStore::openCursor creates one with this's object store, which would be an "internal" object
I suspect the text around sources probably predates splitting the concepts of the abstract "internal" object store/index sitting in the database from the handles (which map 1:1 with the JS-exposed interfaces). So yes, we would want to fix this.
From looking at how the source is used (namely, "Let transaction be the transaction associated with source.") a request's source should be a handle object rather than the internal object, since handle objects have associated transactions. Also, ultimately calling request.source is going to give back an IDBObjectStore, IDBIndex, or IDBCursor so in the former two cases it needs to be the handle object. To do so, we probably need to do a more intrusive change where either (a) the cursor's source is a handle object (and do the extra hop to get from the handle to the internal object), or (b) the cursor holds onto both a handle source and an internal source.
For cursors we need to look carefully at the tests and the behaviors of shipping implementations because there are two cases:
For operations that create or advance the cursor (openCursor, continue, continuePrimaryKey, advance) I believe the source is intended to be the IDBObjectStore / IDBIndex
For operations that add work in the transaction (delete, update) I believe the source is intended to be the IDBCursor.
... but I don't remember very well. Anyway, some archaeology is needed here. PR's welcome!
Activity
inexorabletash commentedon Apr 3, 2025
I suspect the text around sources probably predates splitting the concepts of the abstract "internal" object store/index sitting in the database from the handles (which map 1:1 with the JS-exposed interfaces). So yes, we would want to fix this.
From looking at how the source is used (namely, "Let transaction be the transaction associated with source.") a request's source should be a handle object rather than the internal object, since handle objects have associated transactions. Also, ultimately calling
request.sourceis going to give back anIDBObjectStore,IDBIndex, orIDBCursorso in the former two cases it needs to be the handle object. To do so, we probably need to do a more intrusive change where either (a) the cursor's source is a handle object (and do the extra hop to get from the handle to the internal object), or (b) the cursor holds onto both a handle source and an internal source.For cursors we need to look carefully at the tests and the behaviors of shipping implementations because there are two cases:
sourceis intended to be theIDBObjectStore/IDBIndexsourceis intended to be theIDBCursor.... but I don't remember very well. Anyway, some archaeology is needed here. PR's welcome!
Add handle to cursor to avoid exposing internal state to script (#455)
[IndexedDB] Add more cursor request source WPT coverage
[IndexedDB] Add more cursor request source WPT coverage
[IndexedDB] Add more cursor request source WPT coverage
Bug 1965765 [wpt PR 52432] - [IndexedDB] Add more cursor request sour…
Bug 1965765 [wpt PR 52432] - [IndexedDB] Add more cursor request sour…
Bug 1965765 [wpt PR 52432] - [IndexedDB] Add more cursor request sour…
Bug 1965765 [wpt PR 52432] - [IndexedDB] Add more cursor request sour…
Bug 1965765 [wpt PR 52432] - [IndexedDB] Add more cursor request sour…