Bug 1401522 - Don't apply statusCode sent from parent if mCanceled or mStatus has been modified in the child. r?mayhemer draft
authorSamael Wang <freesamael@gmail.com>
Thu, 28 Sep 2017 11:16:53 +0800
changeset 672427 2384c5c508ae36e54a7dc5b95893f41f72fa1209
parent 669596 7e962631ba4298bcefa571008661983d77c3e652
child 733787 a1158c198c88b3143bbc85150db468b6dde8cd20
push id82230
push userbmo:sawang@mozilla.com
push dateFri, 29 Sep 2017 03:47:35 +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));
   }