mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1520062 - Also release listeners in HttpChannelChild::ActorDestroy r=kershaw
Differential Revision: https://phabricator.services.mozilla.com/D16549 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
dd38890459
commit
6c62662e9d
@ -3292,10 +3292,7 @@ void HttpBaseChannel::DoNotifyListener() {
|
||||
mAfterOnStartRequestBegun = true;
|
||||
}
|
||||
|
||||
if (mListener) {
|
||||
MOZ_ASSERT(!mOnStartRequestCalled,
|
||||
"We should not call OnStartRequest twice");
|
||||
|
||||
if (mListener && !mOnStartRequestCalled) {
|
||||
nsCOMPtr<nsIStreamListener> listener = mListener;
|
||||
listener->OnStartRequest(this, nullptr);
|
||||
|
||||
@ -3307,9 +3304,7 @@ void HttpBaseChannel::DoNotifyListener() {
|
||||
// as not-pending.
|
||||
mIsPending = false;
|
||||
|
||||
if (mListener) {
|
||||
MOZ_ASSERT(!mOnStopRequestCalled, "We should not call OnStopRequest twice");
|
||||
|
||||
if (mListener && !mOnStopRequestCalled) {
|
||||
nsCOMPtr<nsIStreamListener> listener = mListener;
|
||||
listener->OnStopRequest(this, nullptr, mStatus);
|
||||
|
||||
|
@ -536,6 +536,10 @@ void HttpChannelChild::OnStartRequest(
|
||||
!mDivertingToParent,
|
||||
"mDivertingToParent should be unset before OnStartRequest!");
|
||||
|
||||
if (mOnStartRequestCalled && !mIPCOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mCanceled && NS_SUCCEEDED(mStatus)) {
|
||||
mStatus = channelStatus;
|
||||
}
|
||||
@ -666,6 +670,7 @@ void HttpChannelChild::DoOnStartRequest(nsIRequest* aRequest,
|
||||
Cancel(rv);
|
||||
return;
|
||||
}
|
||||
mOnStartRequestCalled = true;
|
||||
|
||||
if (mDivertingToParent) {
|
||||
mListener = nullptr;
|
||||
@ -1030,6 +1035,10 @@ void HttpChannelChild::OnStopRequest(
|
||||
static_cast<uint32_t>(channelStatus)));
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mOnStopRequestCalled && !mIPCOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDivertingToParent) {
|
||||
MOZ_RELEASE_ASSERT(
|
||||
!mFlushedForDiversion,
|
||||
@ -3814,6 +3823,14 @@ void HttpChannelChild::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
// and BackgroundChild might have pending IPC messages.
|
||||
// Clean up BackgroundChild at this time to prevent memleak.
|
||||
if (aWhy != Deletion) {
|
||||
// Make sure all the messages are processed.
|
||||
AutoEventEnqueuer ensureSerialDispatch(mEventQ);
|
||||
|
||||
mStatus = NS_ERROR_DOCSHELL_DYING;
|
||||
HandleAsyncAbort();
|
||||
|
||||
// Cleanup the background channel before we resume the eventQ so we don't
|
||||
// get any other events.
|
||||
CleanupBackgroundChannel();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user