Backed out changeset d271b9e473fd (bug 1122788) for being a possible cause of test_fileapi.html bustage CLOSED TREE

--HG--
extra : commitid : JtZfexvrBDK
This commit is contained in:
Wes Kocher 2015-12-04 15:21:24 -08:00
Родитель b93b82aaa6
Коммит 18c24e60a0
1 изменённых файлов: 17 добавлений и 0 удалений

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

@ -141,10 +141,25 @@ nsMultiplexInputStream::GetCount(uint32_t* aCount)
return NS_OK;
}
#ifdef DEBUG
static bool
SeekableStreamAtBeginning(nsIInputStream* aStream)
{
int64_t streamPos;
nsCOMPtr<nsISeekableStream> stream = do_QueryInterface(aStream);
if (stream && NS_SUCCEEDED(stream->Tell(&streamPos)) && streamPos != 0) {
return false;
}
return true;
}
#endif
NS_IMETHODIMP
nsMultiplexInputStream::AppendStream(nsIInputStream* aStream)
{
MutexAutoLock lock(mLock);
NS_ASSERTION(SeekableStreamAtBeginning(aStream),
"Appended stream not at beginning.");
return mStreams.AppendElement(aStream) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
@ -152,6 +167,8 @@ NS_IMETHODIMP
nsMultiplexInputStream::InsertStream(nsIInputStream* aStream, uint32_t aIndex)
{
MutexAutoLock lock(mLock);
NS_ASSERTION(SeekableStreamAtBeginning(aStream),
"Inserted stream not at beginning.");
mStreams.InsertElementAt(aIndex, aStream);
if (mCurrentStream > aIndex ||
(mCurrentStream == aIndex && mStartedReadingCurrent)) {