diff --git a/mozilla/embedding/browser/gtk/src/EmbedStream.cpp b/mozilla/embedding/browser/gtk/src/EmbedStream.cpp index b53e91b37bb..641c8f0e234 100644 --- a/mozilla/embedding/browser/gtk/src/EmbedStream.cpp +++ b/mozilla/embedding/browser/gtk/src/EmbedStream.cpp @@ -271,6 +271,9 @@ EmbedStream::ReadSegments(nsWriteSegmentFun aWriter, void * aClosure, // XXX writeCount may be less than nBytes!! This is the wrong // way to synthesize ReadSegments. NS_ASSERTION(writeCount == nBytes, "data loss"); + + // errors returned from the writer end here! + rv = NS_OK; } nsMemory::Free(readBuf); diff --git a/mozilla/embedding/browser/photon/src/EmbedStream.cpp b/mozilla/embedding/browser/photon/src/EmbedStream.cpp index 9000df35ffd..b3a9e14039d 100644 --- a/mozilla/embedding/browser/photon/src/EmbedStream.cpp +++ b/mozilla/embedding/browser/photon/src/EmbedStream.cpp @@ -272,6 +272,9 @@ EmbedStream::ReadSegments(nsWriteSegmentFun aWriter, void * aClosure, // XXX writeCount may be less than nBytes!! This is the wrong // way to synthesize ReadSegments. NS_ASSERTION(writeCount == nBytes, "data loss"); + + // errors returned from the writer end here! + rv = NS_OK; } nsMemory::Free(readBuf); diff --git a/mozilla/modules/libjar/nsJARInputStream.cpp b/mozilla/modules/libjar/nsJARInputStream.cpp index 6fa2dadcdfb..43527af2e8f 100644 --- a/mozilla/modules/libjar/nsJARInputStream.cpp +++ b/mozilla/modules/libjar/nsJARInputStream.cpp @@ -75,6 +75,9 @@ nsJARInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint3 // XXX _retval may be less than nBytes!! This is the wrong // way to synthesize ReadSegments. NS_ASSERTION(*_retval == nBytes, "data loss"); + + // errors returned from the writer end here! + rv = NS_OK; } nsMemory::Free(readBuf); diff --git a/mozilla/netwerk/base/src/nsBufferedStreams.cpp b/mozilla/netwerk/base/src/nsBufferedStreams.cpp index c377699ccf2..8493482938c 100644 --- a/mozilla/netwerk/base/src/nsBufferedStreams.cpp +++ b/mozilla/netwerk/base/src/nsBufferedStreams.cpp @@ -302,7 +302,11 @@ nsBufferedInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PR if (amt > 0) { PRUint32 read = 0; rv = writer(this, closure, mBuffer + mCursor, mCursor, amt, &read); - if (NS_FAILED(rv)) break; + if (NS_FAILED(rv)) { + // errors returned from the writer end here! + rv = NS_OK; + break; + } *result += read; count -= read; mCursor += read; diff --git a/mozilla/rdf/base/src/nsRDFXMLDataSource.cpp b/mozilla/rdf/base/src/nsRDFXMLDataSource.cpp index ab41aaa4cbe..671949cdfdf 100644 --- a/mozilla/rdf/base/src/nsRDFXMLDataSource.cpp +++ b/mozilla/rdf/base/src/nsRDFXMLDataSource.cpp @@ -184,9 +184,11 @@ public: *_retval = 0; nsresult rv = writer (this, closure, mBuffer+mIndex, mIndex, readCount, _retval); - mIndex += *_retval; + if (NS_SUCCEEDED(rv)) + mIndex += *_retval; - return rv; + // do not propogate errors returned from writer! + return NS_OK; } NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking) { diff --git a/mozilla/xpcom/io/nsByteArrayInputStream.cpp b/mozilla/xpcom/io/nsByteArrayInputStream.cpp index 05ac1ff165a..5779125c949 100644 --- a/mozilla/xpcom/io/nsByteArrayInputStream.cpp +++ b/mozilla/xpcom/io/nsByteArrayInputStream.cpp @@ -83,7 +83,6 @@ nsByteArrayInputStream::Read (char* aBuffer, PRUint32 aCount, PRUint32 *aNumRead NS_IMETHODIMP nsByteArrayInputStream::ReadSegments(nsWriteSegmentFun writer, void * aClosure, PRUint32 aCount, PRUint32 *aNumRead) { - nsresult rv = NS_OK; if (aNumRead == NULL) return NS_ERROR_NULL_POINTER; @@ -97,14 +96,16 @@ nsByteArrayInputStream::ReadSegments(nsWriteSegmentFun writer, void * aClosure, PRUint32 readCount = PR_MIN(aCount, (_nbytes - _pos)); if (_buffer == NULL) *aNumRead = 0; - else - rv = writer (this, aClosure, &_buffer[_pos], - _pos, readCount, aNumRead); - - _pos += *aNumRead; + else { + nsresult rv = writer (this, aClosure, &_buffer[_pos], + _pos, readCount, aNumRead); + if (NS_SUCCEEDED(rv)) + _pos += *aNumRead; + } } - return rv; + // do not propogate errors returned from writer! + return NS_OK; } NS_IMETHODIMP