Bug 1137054 - Change MIME types as XPCOM string and not char*. r=rkent

This commit is contained in:
Edmund Wong 2015-02-26 17:01:44 +08:00
Родитель 4162710291
Коммит 5557da7445
3 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -31,7 +31,7 @@ NS_IMETHODIMP
MailNewsDLF::CreateInstance(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
const char* aContentType,
const nsACString& aContentType,
nsIDocShell* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
@ -39,7 +39,8 @@ MailNewsDLF::CreateInstance(const char* aCommand,
{
nsresult rv;
bool viewSource = (PL_strstr(aContentType,"view-source") != 0);
bool viewSource = (PL_strstr(PromiseFlatCString(aContentType).get(),
"view-source") != 0);
aChannel->SetContentType(NS_LITERAL_CSTRING(TEXT_HTML));
@ -61,11 +62,11 @@ MailNewsDLF::CreateInstance(const char* aCommand,
if (viewSource) {
rv = factory->CreateInstance("view-source", aChannel, aLoadGroup,
TEXT_HTML "; x-view-type=view-source",
NS_LITERAL_CSTRING(TEXT_HTML "; x-view-type=view-source"),
aContainer, aExtraInfo, getter_AddRefs(listener),
aDocViewer);
} else {
rv = factory->CreateInstance("view", aChannel, aLoadGroup, TEXT_HTML,
rv = factory->CreateInstance("view", aChannel, aLoadGroup, NS_LITERAL_CSTRING(TEXT_HTML),
aContainer, aExtraInfo, getter_AddRefs(listener),
aDocViewer);
}

Просмотреть файл

@ -370,10 +370,10 @@ NS_IMETHODIMP nsMsgWindow::OnStartURIOpen(nsIURI* aURI, bool* aAbortOpen)
return NS_OK;
}
NS_IMETHODIMP nsMsgWindow::DoContent(const char *aContentType, bool aIsContentPreferred,
NS_IMETHODIMP nsMsgWindow::DoContent(const nsACString& aContentType, bool aIsContentPreferred,
nsIRequest *request, nsIStreamListener **aContentHandler, bool *aAbortProcess)
{
if (aContentType)
if (!aContentType.IsEmpty())
{
// forward the DoContent call to our docshell
nsCOMPtr<nsIDocShell> messageWindowDocShell;

Просмотреть файл

@ -110,7 +110,7 @@ nsURLFetcher::CanHandleContent(const char * aContentType,
}
NS_IMETHODIMP
nsURLFetcher::DoContent(const char * aContentType,
nsURLFetcher::DoContent(const nsACString& aContentType,
bool aIsContentPreferred,
nsIRequest *request,
nsIStreamListener ** aContentHandler,
@ -125,14 +125,14 @@ nsURLFetcher::DoContent(const char * aContentType,
/*
Check the content-type to see if we need to insert a converter
*/
if (PL_strcasecmp(aContentType, UNKNOWN_CONTENT_TYPE) == 0 ||
PL_strcasecmp(aContentType, MULTIPART_MIXED_REPLACE) == 0 ||
PL_strcasecmp(aContentType, MULTIPART_MIXED) == 0 ||
PL_strcasecmp(aContentType, MULTIPART_BYTERANGES) == 0)
if (PL_strcasecmp(PromiseFlatCString(aContentType).get(), UNKNOWN_CONTENT_TYPE) == 0 ||
PL_strcasecmp(PromiseFlatCString(aContentType).get(), MULTIPART_MIXED_REPLACE) == 0 ||
PL_strcasecmp(PromiseFlatCString(aContentType).get(), MULTIPART_MIXED) == 0 ||
PL_strcasecmp(PromiseFlatCString(aContentType).get(), MULTIPART_BYTERANGES) == 0)
{
rv = InsertConverter(aContentType);
rv = InsertConverter(PromiseFlatCString(aContentType).get());
if (NS_SUCCEEDED(rv))
mConverterContentType = aContentType;
mConverterContentType = PromiseFlatCString(aContentType).get();
}
return rv;