Bug 1360992 - RecvStreamReady() should be protected by mutex as any other method in IPCBlobInputStreamChild, r=qdot

This commit is contained in:
Andrea Marchesini 2017-05-04 08:37:54 +02:00
Родитель 1b30c06e4e
Коммит f4482d75a5
1 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -167,15 +167,24 @@ IPCBlobInputStreamChild::StreamNeeded(IPCBlobInputStream* aStream,
mozilla::ipc::IPCResult
IPCBlobInputStreamChild::RecvStreamReady(const OptionalIPCStream& aStream)
{
MOZ_ASSERT(!mPendingOperations.IsEmpty());
nsCOMPtr<nsIInputStream> stream = DeserializeIPCStream(aStream);
RefPtr<StreamReadyRunnable> runnable =
new StreamReadyRunnable(mPendingOperations[0].mStream, stream);
mPendingOperations[0].mEventTarget->Dispatch(runnable, NS_DISPATCH_NORMAL);
RefPtr<IPCBlobInputStream> pendingStream;
nsCOMPtr<nsIEventTarget> eventTarget;
mPendingOperations.RemoveElementAt(0);
{
MutexAutoLock lock(mMutex);
MOZ_ASSERT(!mPendingOperations.IsEmpty());
pendingStream = mPendingOperations[0].mStream;
eventTarget = mPendingOperations[0].mEventTarget;
mPendingOperations.RemoveElementAt(0);
}
RefPtr<StreamReadyRunnable> runnable =
new StreamReadyRunnable(pendingStream, stream);
eventTarget->Dispatch(runnable, NS_DISPATCH_NORMAL);
return IPC_OK();
}