Bug 1214516 - Sync check PBackgroundChild existence to initiate indexed DB open/delete request right away if it exists. r=khuey

This commit is contained in:
Ting-Yu Chou 2015-11-25 10:57:07 +08:00
parent 44dd382ffd
commit 0bde4bb147

View File

@ -684,8 +684,6 @@ IDBFactory::OpenInternal(nsIPrincipal* aPrincipal,
}
if (!mBackgroundActor && mPendingRequests.IsEmpty()) {
// We need to start the sequence to create a background actor for this
// thread.
BackgroundChildImpl::ThreadLocal* threadLocal =
BackgroundChildImpl::GetThreadLocalForCurrentThread();
@ -705,12 +703,18 @@ IDBFactory::OpenInternal(nsIPrincipal* aPrincipal,
newIDBThreadLocal = idbThreadLocal = new ThreadLocal(id);
}
RefPtr<BackgroundCreateCallback> cb =
new BackgroundCreateCallback(this, idbThreadLocal->GetLoggingInfo());
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(cb))) {
IDB_REPORT_INTERNAL_ERR();
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return nullptr;
if (PBackgroundChild* actor = BackgroundChild::GetForCurrentThread()) {
BackgroundActorCreated(actor, idbThreadLocal->GetLoggingInfo());
} else {
// We need to start the sequence to create a background actor for this
// thread.
RefPtr<BackgroundCreateCallback> cb =
new BackgroundCreateCallback(this, idbThreadLocal->GetLoggingInfo());
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(cb))) {
IDB_REPORT_INTERNAL_ERR();
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return nullptr;
}
}
if (newIDBThreadLocal) {