mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
265333 NS_NewInputStreamChannel should not overwrite a content charset set from
the content type with an empty string r+sr=darin
This commit is contained in:
parent
d630cce6b0
commit
ded5ac40ed
@ -136,8 +136,7 @@ EmbedStream::OpenStream(const char *aBaseURI, const char *aContentType)
|
||||
// create a new input stream channel
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
|
||||
NS_STATIC_CAST(nsIInputStream *, this),
|
||||
nsDependentCString(aContentType),
|
||||
EmptyCString());
|
||||
nsDependentCString(aContentType));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -119,8 +119,7 @@ EmbedStream::OpenStream(const char *aBaseURI, const char *aContentType)
|
||||
// create a new input stream channel
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
|
||||
NS_STATIC_CAST(nsIInputStream *, this),
|
||||
nsDependentCString(aContentType),
|
||||
NS_LITERAL_CSTRING("") );
|
||||
nsDependentCString(aContentType));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -141,8 +141,7 @@ EmbedStream::OpenStream(const char *aBaseURI, const char *aContentType)
|
||||
// create a new input stream channel
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
|
||||
this,
|
||||
nsDependentCString(aContentType),
|
||||
EmptyCString());
|
||||
nsDependentCString(aContentType));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -131,8 +131,7 @@ nsEmbedStream::OpenStream(const char *aBaseURI, const char *aContentType)
|
||||
// create a new input stream channel
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
|
||||
NS_STATIC_CAST(nsIInputStream *, this),
|
||||
nsDependentCString(aContentType),
|
||||
EmptyCString());
|
||||
nsDependentCString(aContentType));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:set ts=4 sw=4 sts=4 et cin: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -287,8 +288,8 @@ inline nsresult
|
||||
NS_NewInputStreamChannel(nsIChannel **result,
|
||||
nsIURI *uri,
|
||||
nsIInputStream *stream,
|
||||
const nsACString &contentType = EmptyCString(),
|
||||
const nsACString &contentCharset = EmptyCString())
|
||||
const nsACString &contentType,
|
||||
const nsACString *contentCharset)
|
||||
{
|
||||
nsresult rv;
|
||||
static NS_DEFINE_CID(kInputStreamChannelCID, NS_INPUTSTREAMCHANNEL_CID);
|
||||
@ -298,13 +299,35 @@ NS_NewInputStreamChannel(nsIChannel **result,
|
||||
rv |= channel->SetURI(uri);
|
||||
rv |= channel->SetContentStream(stream);
|
||||
rv |= channel->SetContentType(contentType);
|
||||
rv |= channel->SetContentCharset(contentCharset);
|
||||
if (contentCharset && !contentCharset->IsEmpty()) {
|
||||
rv |= channel->SetContentCharset(*contentCharset);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv))
|
||||
NS_ADDREF(*result = channel);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewInputStreamChannel(nsIChannel **result,
|
||||
nsIURI *uri,
|
||||
nsIInputStream *stream,
|
||||
const nsACString &contentType = EmptyCString())
|
||||
{
|
||||
return NS_NewInputStreamChannel(result, uri, stream, contentType, nsnull);
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewInputStreamChannel(nsIChannel **result,
|
||||
nsIURI *uri,
|
||||
nsIInputStream *stream,
|
||||
const nsACString &contentType,
|
||||
const nsACString &contentCharset)
|
||||
{
|
||||
return NS_NewInputStreamChannel(result, uri, stream, contentType,
|
||||
&contentCharset);
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewInputStreamPump(nsIInputStreamPump **result,
|
||||
nsIInputStream *stream,
|
||||
|
Loading…
Reference in New Issue
Block a user