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;
|
mAfterOnStartRequestBegun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mListener) {
|
if (mListener && !mOnStartRequestCalled) {
|
||||||
MOZ_ASSERT(!mOnStartRequestCalled,
|
|
||||||
"We should not call OnStartRequest twice");
|
|
||||||
|
|
||||||
nsCOMPtr<nsIStreamListener> listener = mListener;
|
nsCOMPtr<nsIStreamListener> listener = mListener;
|
||||||
listener->OnStartRequest(this, nullptr);
|
listener->OnStartRequest(this, nullptr);
|
||||||
|
|
||||||
@ -3307,9 +3304,7 @@ void HttpBaseChannel::DoNotifyListener() {
|
|||||||
// as not-pending.
|
// as not-pending.
|
||||||
mIsPending = false;
|
mIsPending = false;
|
||||||
|
|
||||||
if (mListener) {
|
if (mListener && !mOnStopRequestCalled) {
|
||||||
MOZ_ASSERT(!mOnStopRequestCalled, "We should not call OnStopRequest twice");
|
|
||||||
|
|
||||||
nsCOMPtr<nsIStreamListener> listener = mListener;
|
nsCOMPtr<nsIStreamListener> listener = mListener;
|
||||||
listener->OnStopRequest(this, nullptr, mStatus);
|
listener->OnStopRequest(this, nullptr, mStatus);
|
||||||
|
|
||||||
|
@ -536,6 +536,10 @@ void HttpChannelChild::OnStartRequest(
|
|||||||
!mDivertingToParent,
|
!mDivertingToParent,
|
||||||
"mDivertingToParent should be unset before OnStartRequest!");
|
"mDivertingToParent should be unset before OnStartRequest!");
|
||||||
|
|
||||||
|
if (mOnStartRequestCalled && !mIPCOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mCanceled && NS_SUCCEEDED(mStatus)) {
|
if (!mCanceled && NS_SUCCEEDED(mStatus)) {
|
||||||
mStatus = channelStatus;
|
mStatus = channelStatus;
|
||||||
}
|
}
|
||||||
@ -666,6 +670,7 @@ void HttpChannelChild::DoOnStartRequest(nsIRequest* aRequest,
|
|||||||
Cancel(rv);
|
Cancel(rv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mOnStartRequestCalled = true;
|
||||||
|
|
||||||
if (mDivertingToParent) {
|
if (mDivertingToParent) {
|
||||||
mListener = nullptr;
|
mListener = nullptr;
|
||||||
@ -1030,6 +1035,10 @@ void HttpChannelChild::OnStopRequest(
|
|||||||
static_cast<uint32_t>(channelStatus)));
|
static_cast<uint32_t>(channelStatus)));
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
if (mOnStopRequestCalled && !mIPCOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mDivertingToParent) {
|
if (mDivertingToParent) {
|
||||||
MOZ_RELEASE_ASSERT(
|
MOZ_RELEASE_ASSERT(
|
||||||
!mFlushedForDiversion,
|
!mFlushedForDiversion,
|
||||||
@ -3814,6 +3823,14 @@ void HttpChannelChild::ActorDestroy(ActorDestroyReason aWhy) {
|
|||||||
// and BackgroundChild might have pending IPC messages.
|
// and BackgroundChild might have pending IPC messages.
|
||||||
// Clean up BackgroundChild at this time to prevent memleak.
|
// Clean up BackgroundChild at this time to prevent memleak.
|
||||||
if (aWhy != Deletion) {
|
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();
|
CleanupBackgroundChannel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user