mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibWeb: Use Content-Type header to set document encoding
Co-authored-by: Shannon Booth <shannon@serenityos.org>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user