295916 r=mrbkap sr=bz a=shaver

- make parser handle calling Parse with an empty string and aLastCall=true
  correctly
- call that from document.close() even in the non-HTML case


git-svn-id: svn://10.0.0.236/trunk@173960 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cbiesinger%web.de
2005-06-01 19:13:39 +00:00
parent cc04d184fb
commit 620f913e6e
2 changed files with 8 additions and 3 deletions

View File

@@ -1696,10 +1696,12 @@ nsParser::Parse(const nsAString& aSourceBuffer,
nsresult result=NS_OK;
if(aLastCall && aSourceBuffer.IsEmpty()) {
if(!aLastCall && aSourceBuffer.IsEmpty()) {
// Nothing is being passed to the parser so return
// immediately. mUnusedInput will get processed when
// some data is actually passed in.
// But if this is the last call, make sure to finish up
// stuff correctly.
return result;
}
@@ -1712,7 +1714,7 @@ nsParser::Parse(const nsAString& aSourceBuffer,
// till we're completely done.
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
if(!aSourceBuffer.IsEmpty() || !mUnusedInput.IsEmpty()) {
if(aLastCall || !aSourceBuffer.IsEmpty() || !mUnusedInput.IsEmpty()) {
if (aVerifyEnabled) {
mFlags |= NS_PARSER_FLAG_DTD_VERIFICATION;
@@ -1777,7 +1779,7 @@ nsParser::Parse(const nsAString& aSourceBuffer,
pc->mDTDMode = aMode;
}
mUnusedInput.Truncate(0);
mUnusedInput.Truncate();
//printf("Parse(string) iterate: %i",PR_FALSE);
pc->mScanner->Append(aSourceBuffer);