w3c / IndexedDB

Indexed Database API
https://w3c.github.io/IndexedDB/
Other
243 stars 62 forks source link

Cursor property updating precedes success event #340

Open inexorabletash opened 4 years ago

inexorabletash commented 4 years ago

When a cursor advances, say via continue() the steps use the iterate a cursor operation and the asynchronously execute a request steps. This means:

That means the cursor properties update before the event fires, which means polling could see the properties change earlier. I think this is what the obscurely worded #339 is hinting at.

Chrome doesn't implement it this way - properties are not visible on the IDBCursor until the event fires. They're applied synchronously just before the event is dispatched.

asutherland commented 4 years ago

Chrome doesn't implement it this way - properties are not visible on the IDBCursor until the event fires. They're applied synchronously just before the event is dispatched.

This is also how Firefox works. (And it's hard to imagine an implementation that operates using tasks not working this way.)

inexorabletash commented 4 years ago

One possible approach:

(The wording here suffers a bit due to the lack of distinction between the concept-cursor and IDBCursor.)