1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:35:06 +00:00

LibWeb: Port Document interface from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-09-15 21:46:58 +12:00 committed by Andreas Kling
parent 9d88e14f20
commit e74031a396
15 changed files with 108 additions and 96 deletions

View file

@ -136,7 +136,7 @@ HTMLParser::HTMLParser(DOM::Document& document, StringView input, DeprecatedStri
m_document->set_parser({}, *this);
auto standardized_encoding = TextCodec::get_standardized_encoding(encoding);
VERIFY(standardized_encoding.has_value());
m_document->set_encoding(standardized_encoding.value());
m_document->set_encoding(MUST(String::from_utf8(standardized_encoding.value())));
}
HTMLParser::HTMLParser(DOM::Document& document)
@ -3774,7 +3774,7 @@ JS::NonnullGCPtr<HTMLParser> HTMLParser::create_for_scripting(DOM::Document& doc
JS::NonnullGCPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input)
{
if (document.has_encoding())
return document.heap().allocate_without_realm<HTMLParser>(document, input, document.encoding().value());
return document.heap().allocate_without_realm<HTMLParser>(document, input, document.encoding().value().to_deprecated_string());
auto encoding = run_encoding_sniffing_algorithm(document, input);
dbgln_if(HTML_PARSER_DEBUG, "The encoding sniffing algorithm returned encoding '{}'", encoding);
return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);