зеркало из https://github.com/mozilla/gecko-dev.git
Bug 591708 - Initiate all PHttpChannel protocol deletion from the child to avoid races. r=honzab a=blocking-fennec
--HG-- extra : rebase_source : 76568dbe568345aaf276ef166407c9338bf8f477
This commit is contained in:
Родитель
4afc3bd77a
Коммит
d3709482f4
|
@ -580,6 +580,32 @@ HttpChannelChild::OnCancel(const nsresult& status)
|
|||
PHttpChannelChild::Send__delete__(this);
|
||||
}
|
||||
|
||||
class DeleteSelfEvent : public ChannelEvent
|
||||
{
|
||||
public:
|
||||
DeleteSelfEvent(HttpChannelChild* child) : mChild(child) {}
|
||||
void Run() { mChild->DeleteSelf(); }
|
||||
private:
|
||||
HttpChannelChild* mChild;
|
||||
};
|
||||
|
||||
bool
|
||||
HttpChannelChild::RecvDeleteSelf()
|
||||
{
|
||||
if (ShouldEnqueue()) {
|
||||
EnqueueEvent(new DeleteSelfEvent(this));
|
||||
} else {
|
||||
DeleteSelf();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
HttpChannelChild::DeleteSelf()
|
||||
{
|
||||
Send__delete__(this);
|
||||
}
|
||||
|
||||
class Redirect1Event : public ChannelEvent
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -141,6 +141,7 @@ protected:
|
|||
const PRUint32& redirectFlags,
|
||||
const nsHttpResponseHead& responseHead);
|
||||
bool RecvRedirect3Complete();
|
||||
bool RecvDeleteSelf();
|
||||
|
||||
bool GetAssociatedContentSecurity(nsIAssociatedContentSecurity** res = nsnull);
|
||||
|
||||
|
@ -185,6 +186,7 @@ private:
|
|||
const PRUint32& redirectFlags,
|
||||
const nsHttpResponseHead& responseHead);
|
||||
void Redirect3Complete();
|
||||
void DeleteSelf();
|
||||
|
||||
friend class AutoEventEnqueuer;
|
||||
friend class StartRequestEvent;
|
||||
|
@ -195,6 +197,7 @@ private:
|
|||
friend class CancelEvent;
|
||||
friend class Redirect1Event;
|
||||
friend class Redirect3Event;
|
||||
friend class DeleteSelfEvent;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -287,7 +287,7 @@ HttpChannelParentListener::OnRedirectResult(PRBool succeeded)
|
|||
}
|
||||
|
||||
if (!channelToDelete->mIPCClosed)
|
||||
unused << HttpChannelParent::Send__delete__(channelToDelete);
|
||||
unused << channelToDelete->SendDeleteSelf();
|
||||
mRedirectChannel = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -99,6 +99,8 @@ parent:
|
|||
// partial cleanup on parent.
|
||||
DocumentChannelCleanup();
|
||||
|
||||
__delete__();
|
||||
|
||||
child:
|
||||
OnStartRequest(nsHttpResponseHead responseHead,
|
||||
PRBool useResponseHead,
|
||||
|
@ -132,8 +134,7 @@ child:
|
|||
// Called if redirect successful so that child can complete setup.
|
||||
Redirect3Complete();
|
||||
|
||||
both:
|
||||
__delete__();
|
||||
DeleteSelf();
|
||||
};
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче