Fixing bug 104031. Bad string code in nsHTMLDocument::WriteCommon(). r=bzbarsky@mit.edu, sr=vidur@netscape.com

git-svn-id: svn://10.0.0.236/trunk@105453 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com
2001-10-16 01:31:49 +00:00
parent d0561dd100
commit a76d9ab54f
11 changed files with 24 additions and 26 deletions

View File

@@ -2296,19 +2296,13 @@ nsHTMLDocument::WriteCommon(const nsAReadableString& aText,
}
}
const nsAReadableString *text_to_write = &aText;
nsAutoString string_buffer;
if (aNewlineTerminate) {
string_buffer.Assign(aText);
string_buffer.Append((PRUnichar)'\n');
text_to_write = &string_buffer;
}
mWriteLevel++;
rv = mParser->Parse(*text_to_write, NS_GENERATE_PARSER_KEY(),
NS_ConvertASCIItoUCS2("text/html"), PR_FALSE,
static const NS_NAMED_LITERAL_STRING(sNewLine, "\n");
rv = mParser->Parse(aNewlineTerminate ? (aText + sNewLine) : aText,
NS_GENERATE_PARSER_KEY(),
NS_LITERAL_STRING("text/html"), PR_FALSE,
(!mIsWriting || (mWriteLevel > 1)));
mWriteLevel--;