Bug 1401522 - Don't apply statusCode sent from parent if mCanceled or mStatus has been modified in the child. r=mayhemer
authorSamael Wang <freesamael@gmail.com>
Thu, 28 Sep 2017 11:16:53 +0800
changeset 679113 8ebfa90c4ebca44ac1c3829ef54de74d3b004dfc
parent 679112 aae33bcfef8b4d7e66478d9f54ae2f66d8aaf201
child 679114 2ebd11851adf2b09c4bdf38c3270a8eb7d6d9441
push id84141
push userbmo:schien@mozilla.com
push dateThu, 12 Oct 2017 11:13:04 +0000
reviewersmayhemer
bugs1401522
milestone58.0a1
Bug 1401522 - Don't apply statusCode sent from parent if mCanceled or mStatus has been modified in the child. r=mayhemer When a WyciwygChannel is canceled, but WyciwygChannelParent::RecvCancel happens after WyciwygChannelParent::SendOnStartRequest, it would send statusCode=NS_OK to WyciwygChannelChild::OnStartRequest. So we should not apply the statusCode if mCanceled, just like how HttpChannelChild handles it. MozReview-Commit-ID: 5H3PUrlArIA
netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
@@ -186,17 +186,19 @@ WyciwygChannelChild::OnStartRequest(cons
                                     const int32_t& source,
                                     const nsCString& charset,
                                     const nsCString& securityInfo)
 {
   LOG(("WyciwygChannelChild::RecvOnStartRequest [this=%p]\n", this));
 
   mState = WCC_ONSTART;
 
-  mStatus = statusCode;
+  if (!mCanceled && NS_SUCCEEDED(mStatus)) {
+    mStatus = statusCode;
+  }
   mContentLength = contentLength;
   mCharsetSource = source;
   mCharset = charset;
 
   if (!securityInfo.IsEmpty()) {
     NS_DeserializeObject(securityInfo, getter_AddRefs(mSecurityInfo));
   }