Update the string stream interface a bit and simplify the implementation a

lot. Bug 212109, r=dougt, sr=darin
This commit is contained in:
bzbarsky%mit.edu 2006-04-20 03:38:34 +00:00
Родитель a4876aee97
Коммит 4a0fde8374
1 изменённых файлов: 4 добавлений и 9 удалений

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

@ -907,17 +907,12 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
// We need to wrap the data in a new lightweight stream and pass that
// to the parser, because calling ReadSegments() recursively on the same
// stream is not supported.
nsCOMPtr<nsISupports> supportsStream;
rv = NS_NewByteInputStream(getter_AddRefs(supportsStream),fromRawSegment,count);
nsCOMPtr<nsIInputStream> copyStream;
rv = NS_NewByteInputStream(getter_AddRefs(copyStream), fromRawSegment, count);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIInputStream> copyStream(do_QueryInterface(supportsStream));
if (copyStream) {
rv = xmlHttpRequest->mXMLParserStreamListener->OnDataAvailable(xmlHttpRequest->mReadRequest,xmlHttpRequest->mContext,copyStream,toOffset,count);
} else {
NS_ERROR("NS_NewByteInputStream did not give out nsIInputStream!");
rv = NS_ERROR_UNEXPECTED;
}
NS_ASSERTION(copyStream, "NS_NewByteInputStream lied");
rv = xmlHttpRequest->mXMLParserStreamListener->OnDataAvailable(xmlHttpRequest->mReadRequest,xmlHttpRequest->mContext,copyStream,toOffset,count);
}
}