Bug 1155059: Patch 5 - clean up ServiceWorkers and avoid leaks r=nikhil

This commit is contained in:
Randell Jesup 2015-07-09 23:21:46 -04:00
parent 238677c2c0
commit b63478816a

View File

@ -322,7 +322,10 @@ public:
return false;
}
NS_SUCCEEDED(NS_DispatchToMainThread(this));
nsCOMPtr<nsIRunnable> that(this);
if (NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(this)))) {
NS_ASSERTION(false, "Failed to dispatch update back to MainThread in ServiceWorker");
}
return true;
}
@ -812,6 +815,8 @@ ServiceWorkerRegistrationWorkerThread::Update()
MOZ_ASSERT(worker);
worker->AssertIsOnWorkerThread();
// XXX: this pattern guarantees we won't know which thread UpdateRunnable
// will die on (here or MainThread)
nsRefPtr<UpdateRunnable> r = new UpdateRunnable(worker, mScope);
r->Dispatch();
}