From b7c93cae7fab3ad551ea324897b7fef09bd69bc4 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Thu, 7 Sep 2023 15:36:45 +0200 Subject: [PATCH] LibWeb: Set document content type in load_document() Fixes regression in `load_document()` compared to FrameLoader. --- Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp b/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp index 054e3d9936..30dae81445 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp @@ -235,6 +235,10 @@ JS::GCPtr load_document(Optional navigati if (navigation_params->response->body()) { auto process_body = [navigation_params, document](ByteBuffer bytes) { + auto extracted_mime_type = navigation_params->response->header_list()->extract_mime_type().release_value_but_fixme_should_propagate_errors(); + auto mime_type = extracted_mime_type.has_value() ? extracted_mime_type.value().essence().bytes_as_string_view() : StringView {}; + document->set_content_type(mime_type); + if (!parse_document(*document, bytes)) { // FIXME: Load html page with an error if parsing failed. TODO();