Bug 779638: Delay dropping the transaction until later to avoid races. r=bent

This commit is contained in:
Kyle Huey 2012-08-01 14:15:12 -07:00
parent d9f7b8ce1d
commit e55940e70c

View File

@ -42,6 +42,20 @@ public:
virtual nsresult
GetSuccessResult(JSContext* aCx, jsval* aVal) MOZ_OVERRIDE;
virtual nsresult
OnSuccess() MOZ_OVERRIDE
{
static_cast<IDBOpenDBRequest*>(mRequest.get())->SetTransaction(NULL);
return AsyncConnectionHelper::OnSuccess();
}
virtual void
OnError() MOZ_OVERRIDE
{
static_cast<IDBOpenDBRequest*>(mRequest.get())->SetTransaction(NULL);
AsyncConnectionHelper::OnError();
}
virtual nsresult
DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE;
};
@ -339,8 +353,6 @@ IndexedDBDatabaseChild::RecvSuccess(
openHelper = new IPCOpenDatabaseHelper(mDatabase, request);
}
request->SetTransaction(NULL);
MainThreadEventTarget target;
if (NS_FAILED(openHelper->Dispatch(&target))) {
NS_WARNING("Dispatch of IPCOpenDatabaseHelper failed!");
@ -372,7 +384,6 @@ IndexedDBDatabaseChild::RecvError(const nsresult& aRv)
}
openHelper->SetError(aRv);
request->SetTransaction(NULL);
MainThreadEventTarget target;
if (NS_FAILED(openHelper->Dispatch(&target))) {