When we don't find a </script> tag, we should put the entire rest of the document into the script element, but not execute the script. This also makes serialization not serialize the end tags for scripts that don't have them (to preserve round tripping). bug 305873, r=sicking sr=jst

git-svn-id: svn://10.0.0.236/trunk@188619 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mrbkap%gmail.com
2006-01-31 22:19:46 +00:00
parent 0bbe2e6d04
commit 61c90940c0
12 changed files with 138 additions and 64 deletions

View File

@@ -789,11 +789,7 @@ nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,
CTextToken* textToken = NS_STATIC_CAST(CTextToken*, text);
if (isCDATA) {
// The only tags that consume conservatively are <script> and
// <style>, the rest all consume until the end of the document.
result = textToken->ConsumeCharacterData(theTag == eHTMLTag_script ||
theTag == eHTMLTag_style,
theTag != eHTMLTag_script,
result = textToken->ConsumeCharacterData(theTag != eHTMLTag_script,
aScanner,
endTagName,
mFlags,
@@ -836,12 +832,24 @@ nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,
"CTextToken::Consume*Data is broken!");
#endif
result = ConsumeEndTag(PRUnichar('/'), endToken, aScanner);
if (!(mFlags & NS_IPARSER_FLAG_VIEW_SOURCE) &&
NS_SUCCEEDED(result)) {
// If ConsumeCharacterData returned a success result (and
// we're not in view source), then we want to make sure that
// we're going to execute this script (since the result means
// that we've found an end tag that satisfies all of the right
// conditions).
endToken->SetInError(PR_FALSE);
}
} else if (result == kFakeEndTag &&
!(mFlags & NS_IPARSER_FLAG_VIEW_SOURCE)) {
result = NS_OK;
endToken = theAllocator->CreateTokenOfType(eToken_end, theTag,
endTagName);
AddToken(endToken, result, &mTokenDeque, theAllocator);
if (endToken) {
endToken->SetInError(PR_TRUE);
}
} else if (result == kFakeEndTag) {
// If we are here, we are both faking having seen the end tag
// and are in view-source.