Commit bb9f9aa9 authored by hyatt's avatar hyatt

Report <script/> as a warning instead of an error for now, since we

        actually do close it.  (Sigh.)

        Reviewed by beth

        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::parseToken):
        (WebCore::HTMLParser::reportErrorToConsole):
        * html/HTMLParserErrorCodes.cpp:
        (WebCore::htmlParserErrorMessageTemplate):
        (WebCore::isWarning):
        * html/HTMLParserErrorCodes.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21727 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 94376177
2007-05-24 David Hyatt <hyatt@apple.com>
Report <script/> as a warning instead of an error for now, since we
actually do close it. (Sigh.)
Reviewed by beth
* html/HTMLParser.cpp:
(WebCore::HTMLParser::parseToken):
(WebCore::HTMLParser::reportErrorToConsole):
* html/HTMLParserErrorCodes.cpp:
(WebCore::htmlParserErrorMessageTemplate):
(WebCore::isWarning):
* html/HTMLParserErrorCodes.h:
2007-05-24 David Hyatt <hyatt@apple.com>
Add error reporting for the </p> -> <p></p> quirk.
......@@ -243,8 +243,12 @@ PassRefPtr<Node> HTMLParser::parseToken(Token* t)
// If the node does not have a forbidden end tag requirement, and if the broken XML self-closing
// syntax was used, report an error.
if (t->brokenXMLStyle && e->endTagRequirement() != TagStatusForbidden)
reportError(IncorrectXMLSelfCloseError, &t->tagName);
if (t->brokenXMLStyle && e->endTagRequirement() != TagStatusForbidden) {
if (t->tagName == scriptTag)
reportError(IncorrectXMLCloseScriptWarning);
else
reportError(IncorrectXMLSelfCloseError, &t->tagName);
}
}
if (!insertNode(n.get(), t->flat)) {
......@@ -1434,11 +1438,13 @@ void HTMLParser::reportErrorToConsole(HTMLParserErrorCode errorCode, const Atomi
}
const char* errorMsg = htmlParserErrorMessageTemplate(errorCode);
if (!errorMsg)
return;
String message(errorMsg);
message.replace("%tag1", tag1);
message.replace("%tag2", tag2);
page->chrome()->addMessageToConsole(HTMLMessageSource, ErrorMessageLevel, message, lineNumber, document->URL());
page->chrome()->addMessageToConsole(HTMLMessageSource, isWarning(errorCode) ? WarningMessageLevel: ErrorMessageLevel, message, lineNumber, document->URL());
}
}
......@@ -46,12 +46,18 @@ const char* htmlParserErrorMessageTemplate(HTMLParserErrorCode errorCode)
"</br> encountered. Converting </br> into <br>.",
"XML self-closing tag syntax used on %tag1. The tag will not be closed.",
"Stray </p> encountered. Converting </p> into <p></p>.",
"Stray %tag1 encountered. Ignoring close tag."
"Stray %tag1 encountered. Ignoring close tag.",
"XML self-closing tag syntax used on <script>. The tag will be closed by WebKit, but not all engines do this. Change to <script></script> instead for best cross-browser compatibility."
};
if (errorCode >= MisplacedTablePartError && errorCode <= StrayCloseTagError)
if (errorCode >= MisplacedTablePartError && errorCode <= IncorrectXMLCloseScriptWarning)
return errors[errorCode];
return 0;
}
bool isWarning(HTMLParserErrorCode code)
{
return code >= IncorrectXMLCloseScriptWarning;
}
}
......@@ -44,10 +44,12 @@ enum HTMLParserErrorCode {
MalformedBRError,
IncorrectXMLSelfCloseError,
StrayParagraphCloseError,
StrayCloseTagError
StrayCloseTagError,
IncorrectXMLCloseScriptWarning
};
const char* htmlParserErrorMessageTemplate(HTMLParserErrorCode);
bool isWarning(HTMLParserErrorCode);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment