mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-15 23:01:52 +00:00
LibWeb: Use Content-Type header to set document encoding
Co-authored-by: Shannon Booth <shannon@serenityos.org>
This commit is contained in:
parent
1096b64936
commit
8e342e3e23
Notes:
github-actions[bot]
2024-10-23 17:32:00 +00:00
Author: https://github.com/Gingeh
Commit: 8e342e3e23
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1879
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/shannonbooth ✅
3 changed files with 7 additions and 6 deletions
|
@ -4373,11 +4373,11 @@ JS::NonnullGCPtr<HTMLParser> HTMLParser::create_for_scripting(DOM::Document& doc
|
|||
return document.heap().allocate_without_realm<HTMLParser>(document);
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input)
|
||||
JS::NonnullGCPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input, Optional<MimeSniff::MimeType> maybe_mime_type)
|
||||
{
|
||||
if (document.has_encoding())
|
||||
return document.heap().allocate_without_realm<HTMLParser>(document, input, document.encoding().value().to_byte_string());
|
||||
auto encoding = run_encoding_sniffing_algorithm(document, input);
|
||||
auto encoding = run_encoding_sniffing_algorithm(document, input, maybe_mime_type);
|
||||
dbgln_if(HTML_PARSER_DEBUG, "The encoding sniffing algorithm returned encoding '{}'", encoding);
|
||||
return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue