LibWeb: Support for Content-Language HTTP header

This commit is contained in:
Piotr
2025-01-14 20:31:44 +01:00
committed by Tim Ledbetter
parent dda1573746
commit c9edb6ffc4
5 changed files with 51 additions and 0 deletions

View File

@@ -369,6 +369,12 @@ WebIDL::ExceptionOr<GC::Ref<Document>> Document::create_and_initialize(Type type
if (auto maybe_last_modified = navigation_params.response->header_list()->get("Last-Modified"sv.bytes()); maybe_last_modified.has_value())
document->m_last_modified = Core::DateTime::parse("%a, %d %b %Y %H:%M:%S %Z"sv, maybe_last_modified.value());
// NOTE: Non-standard: Pull out the Content-Language header to determine the document's language.
if (auto maybe_http_content_language = navigation_params.response->header_list()->get("Content-Language"sv.bytes()); maybe_http_content_language.has_value()) {
if (auto maybe_content_language = String::from_utf8(maybe_http_content_language.value()); !maybe_content_language.is_error())
document->m_http_content_language = maybe_content_language.release_value();
}
// 10. Set window's associated Document to document.
window->set_associated_document(*document);