Bug 1638172 - avoid name hiding for handling multipart channel in HttpChannelChild, r=mayhemer
authorJunior Hsu <juhsu@mozilla.com>
Thu, 21 May 2020 23:32:31 +0000
changeset 531570 5cf4772a76c18ed44a60768d102f9f4adaf5774a
parent 531569 70b3b48718bd7c0d99203b84134699d54f4c34fb
child 531571 7054e490f0ce9a4fe79e7047dbde56c014eea223
push id37440
push userabutkovits@mozilla.com
push dateFri, 22 May 2020 09:43:16 +0000
treeherdermozilla-central@fbf71e4d2e21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1638172
milestone78.0a1
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 1638172 - avoid name hiding for handling multipart channel in HttpChannelChild, r=mayhemer Differential Revision: https://phabricator.services.mozilla.com/D75445
netwerk/protocol/http/HttpChannelParent.cpp
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -1480,20 +1480,23 @@ HttpChannelParent::OnStartRequest(nsIReq
   nsHttpResponseHead* responseHead = chan->GetResponseHead();
   bool useResponseHead = !!responseHead;
   nsHttpResponseHead cleanedUpResponseHead;
   if (responseHead &&
       (responseHead->HasHeader(nsHttp::Set_Cookie) || multiPartID)) {
     cleanedUpResponseHead = *responseHead;
     cleanedUpResponseHead.ClearHeader(nsHttp::Set_Cookie);
     if (multiPartID) {
-      nsCOMPtr<nsIChannel> chan = do_QueryInterface(aRequest);
-      MOZ_ASSERT(chan);
+      nsCOMPtr<nsIChannel> multiPartChannel = do_QueryInterface(aRequest);
+      // For the multipart channel, use the parsed subtype instead. Note that
+      // `chan` is the underlying base channel of the multipart channel in this
+      // case, which is different from `multiPartChannel`.
+      MOZ_ASSERT(multiPartChannel);
       nsAutoCString contentType;
-      chan->GetContentType(contentType);
+      multiPartChannel->GetContentType(contentType);
       cleanedUpResponseHead.SetContentType(contentType);
     }
     responseHead = &cleanedUpResponseHead;
   }
 
   if (!responseHead) {
     responseHead = &cleanedUpResponseHead;
   }