Bug 784404 - Intermittent assertion in dom/devicestorage/test/test_basic.html. r=bent

This commit is contained in:
Doug Turner 2012-08-26 21:28:10 -07:00
parent fc14088df0
commit cfa68bef6d

View File

@ -49,11 +49,17 @@ private:
nsresult rv = NS_OK;
if (!mCanceled) {
rv = CancelableRun();
mParent->RemoveRunnable(this);
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &CancelableRunnable::RemoveRunnable);
NS_DispatchToMainThread(event);
}
return rv;
}
void RemoveRunnable() {
mParent->RemoveRunnable(this);
}
void Cancel() {
mCanceled = true;
}
@ -184,9 +190,11 @@ private:
protected:
void AddRunnable(CancelableRunnable* aRunnable) {
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
mRunnables.AppendElement(aRunnable);
}
void RemoveRunnable(CancelableRunnable* aRunnable) {
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
mRunnables.RemoveElement(aRunnable);
}
nsTArray<nsRefPtr<CancelableRunnable> > mRunnables;