mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-08 04:02:52 +00:00
LibWeb: Add a way to stop the new HTML parser
Some things are specced to "stop parsing", which basically just means to stop fetching tokens and jump to "The end"
This commit is contained in:
parent
00b44ab148
commit
68b1bdc234
Notes:
sideshowbarker
2024-07-19 06:01:32 +09:00
Author: https://github.com/awesomekling
Commit: 68b1bdc234
2 changed files with 11 additions and 3 deletions
|
@ -76,6 +76,11 @@ void HTMLDocumentParser::run(const URL& url)
|
|||
dbg() << "[" << insertion_mode_name() << "] " << token.to_string();
|
||||
#endif
|
||||
process_using_the_rules_for(m_insertion_mode, token);
|
||||
|
||||
if (m_stop_parsing) {
|
||||
dbg() << "Stop parsing! :^)";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// "The end"
|
||||
|
@ -497,8 +502,8 @@ void HTMLDocumentParser::handle_after_body(HTMLToken& token)
|
|||
}
|
||||
|
||||
if (token.is_end_of_file()) {
|
||||
// FIXME: Stop parsing!
|
||||
TODO();
|
||||
stop_parsing();
|
||||
return;
|
||||
}
|
||||
|
||||
if (token.is_end_tag() && token.tag_name() == "html") {
|
||||
|
@ -522,7 +527,7 @@ void HTMLDocumentParser::handle_after_after_body(HTMLToken& token)
|
|||
}
|
||||
|
||||
if (token.is_end_of_file()) {
|
||||
dbg() << "Stop parsing! :^)";
|
||||
stop_parsing();
|
||||
return;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue