Bug 569044 - "e10s HTTP: handle requests with no responseHead" [r=jduell]
authorHonza Bambas <honzab.moz>
Fri, 18 Jun 2010 03:32:00 -0700
changeset 46911 e9367578b98ab35181533c0762e710b7f5607165
parent 46910 7050d2595c2da5d660ec1e0c62af72dbe0cc4943
child 46912 7f7b9ee37084d876ff909b761642b877beaafd0f
push id14210
push userdougt@mozilla.com
push dateThu, 01 Jul 2010 06:28:42 +0000
treeherdermozilla-central@3aff97777291 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs569044
milestone1.9.3a6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 569044 - "e10s HTTP: handle requests with no responseHead" [r=jduell]
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelChild.h
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/PHttpChannel.ipdl
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -98,35 +98,41 @@ NS_INTERFACE_MAP_BEGIN(HttpChannelChild)
   NS_INTERFACE_MAP_ENTRY(nsIApplicationCacheChannel)
 NS_INTERFACE_MAP_END_INHERITING(HttpBaseChannel)
 
 //-----------------------------------------------------------------------------
 // HttpChannelChild::PHttpChannelChild
 //-----------------------------------------------------------------------------
 
 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)) {
     // TODO: Cancel request: (bug 536317)
     //  - Send Cancel msg to parent 
     //  - drop any in flight OnDataAvail msgs we receive
     //  - make sure we do call OnStopRequest eventually
     //  - return true here, not false
     return false;  
   }
 
-  SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie));
+  if (mResponseHead)
+    SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie));
 
   return true;
 }
 
 bool 
 HttpChannelChild::RecvOnDataAvailable(const nsCString& data,
                                       const PRUint32& offset,
                                       const PRUint32& count)
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -109,17 +109,18 @@ public:
                               PRBool aMerge);
   // nsIHttpChannelInternal
   NS_IMETHOD SetupFallbackChannel(const char *aFallbackKey);
   // nsISupportsPriority
   NS_IMETHOD SetPriority(PRInt32 value);
 
 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);
   bool RecvOnStopRequest(const nsresult& statusCode);
   bool RecvOnProgress(const PRUint64& progress, const PRUint64& progressMax);
   bool RecvOnStatus(const nsresult& status, const nsString& statusArg);
 
 private:
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -187,20 +187,22 @@ HttpChannelParent::RecvSetPriority(const
 
 NS_IMETHODIMP
 HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
 {
   LOG(("HttpChannelParent::OnStartRequest [this=%x]\n", this));
 
   nsHttpChannel *chan = static_cast<nsHttpChannel *>(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;
 }
 
 NS_IMETHODIMP
 HttpChannelParent::OnStopRequest(nsIRequest *aRequest, 
                                  nsISupports *aContext, 
                                  nsresult aStatusCode)
 {
--- a/netwerk/protocol/http/PHttpChannel.ipdl
+++ b/netwerk/protocol/http/PHttpChannel.ipdl
@@ -74,17 +74,18 @@ parent:
             PRUint16            priority,
             PRUint8             redirectionLimit,
             PRBool              allowPipelining,
             PRBool              forceAllowThirdPartyCookie);
 
   SetPriority(PRUint16 priority);
 
 child:
-  OnStartRequest(nsHttpResponseHead responseHead);
+  OnStartRequest(nsHttpResponseHead responseHead,
+                 PRBool useResponseHead);
 
   OnDataAvailable(nsCString data, 
                   PRUint32  offset, 
                   PRUint32  count);
 
   OnStopRequest(nsresult statusCode);
 
   OnProgress(PRUint64 progress, PRUint64 progressMax);