Bug 1524864 - nsMIMEInputStream should expose nsISeekableStream only if the underlying stream is seekable, r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D18528

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2019-02-04 21:50:47 +00:00
Родитель 667401357b
Коммит 7b5225038d
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -72,6 +72,7 @@ class nsMIMEInputStream : public nsIMIMEInputStream,
const char* aFromRawSegment, uint32_t aToOffset,
uint32_t aCount, uint32_t* aWriteCount);
bool IsSeekableInputStream() const;
bool IsAsyncInputStream() const;
bool IsIPCSerializable() const;
bool IsInputStreamLength() const;
@ -101,8 +102,8 @@ NS_IMPL_CLASSINFO(nsMIMEInputStream, nullptr, nsIClassInfo::THREADSAFE,
NS_INTERFACE_MAP_BEGIN(nsMIMEInputStream)
NS_INTERFACE_MAP_ENTRY(nsIMIMEInputStream)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIInputStream, nsIMIMEInputStream)
NS_INTERFACE_MAP_ENTRY(nsISeekableStream)
NS_INTERFACE_MAP_ENTRY(nsITellableStream)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISeekableStream, IsSeekableInputStream())
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIIPCSerializableInputStream,
IsIPCSerializable())
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAsyncInputStream, IsAsyncInputStream())
@ -464,6 +465,11 @@ nsMIMEInputStream::OnInputStreamLengthReady(nsIAsyncInputStreamLength* aStream,
return callback->OnInputStreamLengthReady(this, aLength);
}
bool nsMIMEInputStream::IsSeekableInputStream() const {
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mStream);
return !!seekable;
}
bool nsMIMEInputStream::IsAsyncInputStream() const {
nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(mStream);
return !!asyncStream;