mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 14:40:18 +00:00
LibWeb: Ensure parser cannot change the mode is handled
This fixes at least 1 wpt bug where text/plain documents are rendered in quirks mode. The test in question: https://wpt.live/html/browsers/browsing-the-web/read-text/load-text-plain.html
This commit is contained in:
parent
3c6472dc00
commit
e442aa6e10
Notes:
github-actions[bot]
2025-09-07 10:12:43 +00:00
Author: https://github.com/Euro20179 🔰
Commit: e442aa6e10
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6093
Reviewed-by: https://github.com/tcl3 ✅
6 changed files with 71 additions and 3 deletions
|
@ -606,16 +606,26 @@ void HTMLParser::handle_initial(HTMLToken& token)
|
|||
// Otherwise, if the document is not an iframe srcdoc document, and the parser cannot change the mode flag is false,
|
||||
// and the DOCTYPE token matches one of the conditions in the following list, then set the Document to limited-quirks mode:
|
||||
// [...]
|
||||
document().set_quirks_mode(which_quirks_mode(token));
|
||||
if (!document().parser_cannot_change_the_mode())
|
||||
document().set_quirks_mode(which_quirks_mode(token));
|
||||
|
||||
// Then, switch the insertion mode to "before html".
|
||||
m_insertion_mode = InsertionMode::BeforeHTML;
|
||||
return;
|
||||
}
|
||||
// -> Anything else
|
||||
|
||||
// FIXME: If the document is not an iframe srcdoc document, then this is a parse error
|
||||
|
||||
log_parse_error();
|
||||
document().set_quirks_mode(DOM::QuirksMode::Yes);
|
||||
|
||||
// if the parser cannot change the mode flag is false, set the Document to quirks mode.
|
||||
if (!document().parser_cannot_change_the_mode())
|
||||
document().set_quirks_mode(DOM::QuirksMode::Yes);
|
||||
|
||||
// In any case, switch the insertion mode to "before html"
|
||||
m_insertion_mode = InsertionMode::BeforeHTML;
|
||||
// then reprocess the token.
|
||||
process_using_the_rules_for(InsertionMode::BeforeHTML, token);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue