Bug 738952 Make it possible for a stream converter to propagate the actual MIME type to the document r=bz
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sat, 02 Mar 2013 14:23:20 +0000
changeset 125155 1cd1a9fdf8fba4c777b4cb044cad1641c0186010
parent 125154 7d93ba84ce2f3718173b98978ee5876bd1650e6f
child 125156 fbdbdebeb0dd51c0b949244edef9e38916d27984
push idunknown
push userunknown
push dateunknown
reviewersbz
bugs738952
milestone22.0a1
Bug 738952 Make it possible for a stream converter to propagate the actual MIME type to the document r=bz
content/base/src/nsDocument.cpp
mach
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -2255,17 +2255,20 @@ nsDocument::StartDocumentLoad(const char
 
   mHaveInputEncoding = true;
 
   if (aReset) {
     Reset(aChannel, aLoadGroup);
   }
 
   nsAutoCString contentType;
-  if (NS_SUCCEEDED(aChannel->GetContentType(contentType))) {
+  nsCOMPtr<nsIPropertyBag2> bag = do_QueryInterface(aChannel);
+  if ((bag && NS_SUCCEEDED(bag->GetPropertyAsACString(
+                NS_LITERAL_STRING("contentType"), contentType))) ||
+      NS_SUCCEEDED(aChannel->GetContentType(contentType))) {
     // XXX this is only necessary for viewsource:
     nsACString::const_iterator start, end, semicolon;
     contentType.BeginReading(start);
     contentType.EndReading(end);
     semicolon = start;
     FindCharInReadable(';', semicolon, end);
     SetContentTypeInternal(Substring(start, semicolon));
   }