Repository navigation
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Text directly inside a
<noscript>, e.g.<body><noscript>Enable JS</noscript></body>or the same inside<head>, crashes the parser with a stack overflow, which takes down the whole process. HtmlKit tokenizes the noscript content as raw text, soHtmlParserreparses every data token inside a noscript as markup, but for plain text the reparse yields the same data token again with the noscript still being the current box, so it recurses forever. Additionally the raw text gets split into several data tokens at every<and each reparse starts again at the noscript, so with<noscript><p><b>a</b><i>b</i></p></noscript>everything after<b>ended up as a sibling of the<p>instead of inside it.The parser now collects all data tokens of the noscript first, parses the whole content once with the noscript box as root and treats data directly in that root as text. Since the library doesn't support scripting, that's how the HTML spec wants noscript content to be handled.
How to test this PR?
CI should succeed.
HtmlParserTests.Noscript_TextIsParsedAsTextcovers text inside noscript in the body and the head and crashes the test host on master,HtmlParserTests.Noscript_MarkupKeepsItsStructurecovers the split content and fails on master.