Bug 1629529 - fix shutdown dispatch assert in WebrtcTCPSocket. r=bwc

If we're shutting down and mSocketThread is no longer accepting work,
this dispatch can fail.  As far as I can see, fully fixing this would
require changes to nsIThread in order to allow checking whether the
thread is shutting down.

Differential Revision: https://phabricator.services.mozilla.com/D71964
This commit is contained in:
Michael Froman 2020-04-22 14:33:01 +00:00
Родитель 5acad1e764
Коммит b5392b2074
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -106,9 +106,13 @@ void WebrtcTCPSocket::CloseWithReason(nsresult aReason) {
// Let's pretend we got an open even if we didn't to prevent an Open later.
mOpened = true;
MOZ_ALWAYS_SUCCEEDS(mSocketThread->Dispatch(NewRunnableMethod<nsresult>(
// This was MOZ_ALWAYS_SUCCEEDS, but that now uses MOZ_DIAGNOSTIC_ASSERT.
// In order to convert this back to MOZ_ALWAYS_SUCCEEDS we would need
// OnSocketThread to return true if we're shutting down and doing the
// "running all of STS's queued events on main" thing.
MOZ_ASSERT(NS_SUCCEEDED(mSocketThread->Dispatch(NewRunnableMethod<nsresult>(
"WebrtcTCPSocket::CloseWithReason", this,
&WebrtcTCPSocket::CloseWithReason, aReason)));
&WebrtcTCPSocket::CloseWithReason, aReason))));
return;
}