From 16be797df3c16e0c0c772f13f5619245df03d5a7 Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Fri, 18 Jun 2010 03:32:00 -0700 Subject: [PATCH] Bug 569044 - "e10s HTTP: handle requests with no responseHead" [r=jduell] --- netwerk/protocol/http/HttpChannelChild.cpp | 12 +++++++++--- netwerk/protocol/http/HttpChannelChild.h | 3 ++- netwerk/protocol/http/HttpChannelParent.cpp | 6 ++++-- netwerk/protocol/http/PHttpChannel.ipdl | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index cf0ce842ec81..533fc5946f3c 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -103,13 +103,18 @@ NS_INTERFACE_MAP_END_INHERITING(HttpBaseChannel) //----------------------------------------------------------------------------- bool -HttpChannelChild::RecvOnStartRequest(const nsHttpResponseHead& responseHead) +HttpChannelChild::RecvOnStartRequest(const nsHttpResponseHead& responseHead, + const PRBool& useResponseHead) { LOG(("HttpChannelChild::RecvOnStartRequest [this=%x]\n", this)); mState = HCC_ONSTART; - mResponseHead = new nsHttpResponseHead(responseHead); + if (useResponseHead) + mResponseHead = new nsHttpResponseHead(responseHead); + else + mResponseHead = nsnull; + nsresult rv = mListener->OnStartRequest(this, mListenerContext); if (NS_FAILED(rv)) { @@ -121,7 +126,8 @@ HttpChannelChild::RecvOnStartRequest(const nsHttpResponseHead& responseHead) return false; } - SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie)); + if (mResponseHead) + SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie)); return true; } diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h index 7c10c8e9758a..e694889a7498 100644 --- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -114,7 +114,8 @@ public: protected: void RefcountHitZero(); - bool RecvOnStartRequest(const nsHttpResponseHead& responseHead); + bool RecvOnStartRequest(const nsHttpResponseHead& responseHead, + const PRBool& useResponseHead); bool RecvOnDataAvailable(const nsCString& data, const PRUint32& offset, const PRUint32& count); diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 574b4bec806e..c0733a891fb1 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -192,10 +192,12 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) nsHttpChannel *chan = static_cast(aRequest); nsHttpResponseHead *responseHead = chan->GetResponseHead(); - NS_ABORT_IF_FALSE(responseHead, "Missing HTTP responseHead!"); - if (mIPCClosed || !SendOnStartRequest(*responseHead)) + if (mIPCClosed || !SendOnStartRequest(responseHead ? *responseHead : nsHttpResponseHead(), + !!responseHead)) { return NS_ERROR_UNEXPECTED; + } + return NS_OK; } diff --git a/netwerk/protocol/http/PHttpChannel.ipdl b/netwerk/protocol/http/PHttpChannel.ipdl index 564fefee5996..3c1404192bb1 100644 --- a/netwerk/protocol/http/PHttpChannel.ipdl +++ b/netwerk/protocol/http/PHttpChannel.ipdl @@ -79,7 +79,8 @@ parent: SetPriority(PRUint16 priority); child: - OnStartRequest(nsHttpResponseHead responseHead); + OnStartRequest(nsHttpResponseHead responseHead, + PRBool useResponseHead); OnDataAvailable(nsCString data, PRUint32 offset,