Bug 1371893 - Stop relying on nsIStringInputStream inheriting from nsIInputStream in comm-central code. r=jorgk,rkent

This commit is contained in:
Boris Zbarsky 2017-06-09 23:45:41 -04:00
Родитель 8bb99798ce
Коммит e616bde4ee
4 изменённых файлов: 14 добавлений и 8 удалений

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

@ -1001,7 +1001,7 @@ calIcalComponent::SerializeToICSStream(nsIInputStream **aStreamResult)
nsresult rv = Serialize(&icalstr);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringInputStream> const aStringStream(
nsCOMPtr<nsIStringInputStream> aStringStream(
do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// copies the string into the input stream that's handed back.
@ -1009,8 +1009,7 @@ calIcalComponent::SerializeToICSStream(nsIInputStream **aStreamResult)
// it's one of libical's ring buffers
rv = aStringStream->SetData(icalstr, -1);
NS_ENSURE_SUCCESS(rv, rv);
NS_ADDREF(*aStreamResult = aStringStream);
return rv;
return CallQueryInterface(aStringStream, aStreamResult);
}
nsresult

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

@ -27,6 +27,7 @@
#include "nsIAsyncOutputStream.h"
#include "nsIPipe.h"
#include "nsIPrincipal.h"
#include "nsIInputStream.h"
nsAddbookProtocolHandler::nsAddbookProtocolHandler()
{
@ -99,10 +100,11 @@ nsAddbookProtocolHandler::GenerateXMLOutputChannel( nsString &aOutput,
rv = inStr->SetData(utf8String.get(), utf8String.Length());
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIInputStream> stream(do_QueryInterface(inStr));
if (aLoadInfo) {
return NS_NewInputStreamChannelInternal(_retval,
aURI,
inStr,
stream,
NS_LITERAL_CSTRING("text/xml"),
EmptyCString(),
aLoadInfo);
@ -116,7 +118,7 @@ nsAddbookProtocolHandler::GenerateXMLOutputChannel( nsString &aOutput,
return NS_NewInputStreamChannel(_retval,
aURI,
inStr,
stream,
nullPrincipal,
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
nsIContentPolicy::TYPE_OTHER,

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

@ -77,6 +77,7 @@
#include "locale.h"
#include "nsStringStream.h"
#include "nsIInputStreamPump.h"
#include "nsIInputStream.h"
#include "nsIChannel.h"
/* for logging to Error Console */
@ -1923,8 +1924,10 @@ MsgStreamMsgHeaders(nsIInputStream *aInputStream, nsIStreamListener *aConsumer)
do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
hdrsStream->SetData(msgHeaders.get(), msgHeaders.Length());
nsCOMPtr<nsIInputStream> stream(do_QueryInterface(hdrsStream));
nsCOMPtr<nsIInputStreamPump> pump;
rv = NS_NewInputStreamPump(getter_AddRefs(pump), hdrsStream);
rv = NS_NewInputStreamPump(getter_AddRefs(pump), stream);
NS_ENSURE_SUCCESS(rv, rv);
return pump->AsyncRead(aConsumer, nullptr);

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

@ -2944,8 +2944,10 @@ NS_IMETHODIMP nsImapMailFolder::ParseMsgHdrs(nsIImapProtocol *aProtocol, nsIImap
NS_ENSURE_SUCCESS(rv, rv);
inputStream->ShareData(msgHdrs, strlen(msgHdrs));
GetMessageHeader(msgKey, getter_AddRefs(msgHdr));
if (msgHdr)
GetMsgPreviewTextFromStream(msgHdr, inputStream);
if (msgHdr) {
nsCOMPtr<nsIInputStream> stream(do_QueryInterface(inputStream));
GetMsgPreviewTextFromStream(msgHdr, stream);
}
continue;
}
if (mDatabase && NS_SUCCEEDED(mDatabase->ContainsKey(msgKey, &containsKey)) && containsKey)