LibWeb: Set document content type in load_document()

Fixes regression in `load_document()` compared to FrameLoader.
This commit is contained in:
Aliaksandr Kalenik 2023-09-07 15:36:45 +02:00 committed by Andreas Kling
parent c437f16cc1
commit b7c93cae7f
Notes: sideshowbarker 2024-07-17 03:51:15 +09:00

View File

@ -235,6 +235,10 @@ JS::GCPtr<DOM::Document> load_document(Optional<HTML::NavigationParams> 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();