[Webkit-unassigned] [Bug 93054] New: IndexedDB: Fire error rather than raising on request creation if transaction aborts asynchronously.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 2 18:15:51 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=93054

           Summary: IndexedDB: Fire error rather than raising on request
                    creation if transaction aborts asynchronously.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: jsbell at chromium.org
                CC: dgrogan at chromium.org, alecflett at chromium.org


In the IDB methods that create IDBRequests follow this pattern:

PassRefPtr<IDBRequest> IDBFoo::frobWidget()
{
    if (!m_transaction->isActive()) {
        ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;
        return 0;
    }
    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
    m_backend->frobWidget(request, m_transaction->backend(), ec);
    if (ec) {
        request->markEarlyDeath();
        return 0;
    }
    return request.release();
}

IDBFooBackendImpl::frobWidget(PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
    if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask(
            createCallbackTask(&IDBFooBackendImpl::frobWidgetInternal, this, callbacks)))
        ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;
}

Note the two places where inactive transactions are tested for - this is because the backend may abort at the same time (different thread/process) as the script is issuing the request. This has the side effect that this user code could fail:

var request1 = foo.frobWidget(); // no exception - but will get abort event
// transaction backend aborts asynchronously here
var request2 = foo.frobWidget(); // throws exception

Ideally, TransactionInactiveError would not be issued until the script was at least plausibly aware.

To simplify the implementation and make for a more consistent developer experience, maybe we can:
* Remove the markEarlyDeath() logic and state, which simplifies IDBRequest.
* If the have either the front end or back end fire an AbortError event at the request if the transaction aborted asynchronously

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list