New issue
Advanced search Search tips

Issue 723846 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 717812



Sign in to add a comment

IndexedDB: Update request state when dispatching event

Project Member Reported by jsb...@chromium.org, May 17 2017

Issue description

The Indexed DB spec (and, from testing, other implementations) work something like this:

1. Wait for this request's turn.
2. Do some magical back-end operations to compute result.
3. Queue a task to run these steps:
    1. Set request's result to result.
    2. Set request's readyState to 'done'.
    3. Fire a 'success' event at request.

Blink's implementation works like this:

1. Wait for this request's turn.
2. Do some magical back-end operations to compute result.
3. Queue a task to run these steps:
    1. Set request's result to result.
    2. Set request's readyState to 'done'.
    3. Queue a task to fire a 'success' event at request.

This is observable as racy behavior where the change to request's state is observable before the event fires, either through polling or e.g. when a failed upgrade's 'abort' is queued then the 'error' is queued. Depending on when the queue is processed, the request's state may have changed before or after the 'abort' is actually dispatched.

We already special case this for cursors, in that a cursor's state doesn't change until the event is dispatched: 

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp?l=454

Now that we're introducing overall response queuing to handle large value wrapping maybe can fix and simplify here.
 

Comment 1 by pwnall@chromium.org, May 17 2017

Funny, I was thinking of this aspect when I was documenting the new HandleResponse() methods, and I was wondering whether script can observe the gap between EnqueueResultInternal() and event dispatch.

Comment 3 by dmu...@chromium.org, May 15 2018

This should be fixed with onion souping.

Comment 4 by dmu...@chromium.org, May 15 2018

Blockedon: 717812
j

Sign in to add a comment