Bug 738952 Make it possible for a stream converter to propagate the actual MIME type to the document r=bz
--- 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));
}