diff --git a/htmlparser/src/nsScanner.cpp b/htmlparser/src/nsScanner.cpp
index f23bd65e4fa5..4ffdcdce0ce4 100644
--- a/htmlparser/src/nsScanner.cpp
+++ b/htmlparser/src/nsScanner.cpp
@@ -294,8 +294,10 @@ PRBool nsScanner::UngetReadable(const nsAString& aBuffer) {
mSlidingBuffer->UngetReadable(aBuffer,mCurrentPosition);
mSlidingBuffer->BeginReading(mCurrentPosition); // Insertion invalidated our iterators
mSlidingBuffer->EndReading(mEndPosition);
- mTotalRead += aBuffer.Length();
-
+
+ PRUint32 length = aBuffer.Length();
+ mCountRemaining += length; // Ref. bug 117441
+ mTotalRead += length;
return PR_TRUE;
}
diff --git a/parser/htmlparser/src/nsScanner.cpp b/parser/htmlparser/src/nsScanner.cpp
index f23bd65e4fa5..4ffdcdce0ce4 100644
--- a/parser/htmlparser/src/nsScanner.cpp
+++ b/parser/htmlparser/src/nsScanner.cpp
@@ -294,8 +294,10 @@ PRBool nsScanner::UngetReadable(const nsAString& aBuffer) {
mSlidingBuffer->UngetReadable(aBuffer,mCurrentPosition);
mSlidingBuffer->BeginReading(mCurrentPosition); // Insertion invalidated our iterators
mSlidingBuffer->EndReading(mEndPosition);
- mTotalRead += aBuffer.Length();
-
+
+ PRUint32 length = aBuffer.Length();
+ mCountRemaining += length; // Ref. bug 117441
+ mTotalRead += length;
return PR_TRUE;
}