Bug 1169613 - Use content type of synthesized response for JAR channel requests if available. Part 2: Set Content-Type for JAR Channel requests on Fetch API responses. r=nsm
authorFernando Jimenez <ferjmoreno@gmail.com>
Fri, 05 Jun 2015 12:53:58 +0200
changeset 247346 99fc1ca23701c27fe0e85764f9c9947cd59530a6
parent 247345 bf8a4b45e3da9b89188529b57b2d93b4b0294748
child 247347 52256ba02d2eade9d5f26aadc5f720d9cdaf3c14
push id60681
push userferjmoreno@gmail.com
push dateFri, 05 Jun 2015 10:54:12 +0000
treeherdermozilla-inbound@52256ba02d2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnsm
bugs1169613
milestone41.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 1169613 - Use content type of synthesized response for JAR channel requests if available. Part 2: Set Content-Type for JAR Channel requests on Fetch API responses. r=nsm
dom/fetch/FetchDriver.cpp
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -679,16 +679,23 @@ FetchDriver::OnStartRequest(nsIRequest* 
     nsCOMPtr<nsIJARChannel> jarChannel = do_QueryInterface(aRequest);
     // If it is not an http channel, it has to be a jar one.
     MOZ_ASSERT(jarChannel);
 
     // We simulate the http protocol for jar/app requests
     uint32_t responseStatus = 200;
     nsAutoCString statusText;
     response = new InternalResponse(responseStatus, NS_LITERAL_CSTRING("OK"));
+    ErrorResult result;
+    nsAutoCString contentType;
+    jarChannel->GetContentType(contentType);
+    response->Headers()->Append(NS_LITERAL_CSTRING("content-type"),
+                                contentType,
+                                result);
+    MOZ_ASSERT(!result.Failed());
   }
 
   // We open a pipe so that we can immediately set the pipe's read end as the
   // response's body. Setting the segment size to UINT32_MAX means that the
   // pipe has infinite space. The nsIChannel will continue to buffer data in
   // xpcom events even if we block on a fixed size pipe.  It might be possible
   // to suspend the channel and then resume when there is space available, but
   // for now use an infinite pipe to avoid blocking.