Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
HTML fast parser fails to parse complex HTML entities
https://bugs.webkit.org/show_bug.cgi?id=255302 Reviewed by Ryosuke Niwa. When trying to parse a non-trivial HTML entity such as `¢`, the fast HTML parser would call `consumeHTMLEntity()` with the string "cent". This would always fail `notEnoughCharacters` would be set to true. This is because our parser currently requires data after the HTML entity to make sure we reached the end of the entity. To address the issue, the HTML fast parser now includes the trailing semicolon when calling `consumeHTMLEntity()`. We now pass the string "cent;" for example. I also tweaked the HTMLEntityParser to not fail with `notEnoughCharacters` if the last character was a semicolon. In this case, it is safe to assume the entity was complete, even though we don't know what comes next in the stream. * Source/WebCore/Headers.cmake: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/DocumentFragment.h: * Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp: (WebCore::HTMLFastPathParser::scanHTMLCharacterReference): * Source/WebCore/html/parser/HTMLDocumentParserFastPath.h: * Source/WebCore/html/parser/HTMLEntityParser.cpp: (WebCore::HTMLEntityParser::consumeNamedEntity): * Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/262856@main
- Loading branch information
Showing
8 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters