Bug 1382380 - ensure mListener/mListenerContext/mCompressListener is released on main thread. r=dragana

During abnormal shutdown, HttpChannelChild might be released on STS thread. However, not all stream listener
that attached to the HTTP channel is thread-safe to be released on non-main thread. By following
HttpBaseChannel::ReleaseListener, we should ensure mListener/mListenerContext/mCompressListener is released on
main thread for both normal channel close and abnormal shutdown scenario.

MozReview-Commit-ID: Gqbk7dUOIcI
This commit is contained in:
Shih-Chiang Chien
2017-07-21 09:51:04 +08:00
parent c6449313ee
commit 46c7569f25
2 changed files with 7 additions and 5 deletions

View File

@@ -257,6 +257,9 @@ HttpBaseChannel::ReleaseMainThreadOnlyReferences()
arrayToRelease.AppendElement(mProxyURI.forget());
arrayToRelease.AppendElement(mPrincipal.forget());
arrayToRelease.AppendElement(mTopWindowURI.forget());
arrayToRelease.AppendElement(mListener.forget());
arrayToRelease.AppendElement(mListenerContext.forget());
arrayToRelease.AppendElement(mCompressListener.forget());
NS_DispatchToMainThread(new ProxyReleaseRunnable(Move(arrayToRelease)));
}