From 65ab6d3b6fb7205c60d1adb8f24992d759936e24 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 3 Mar 2023 09:27:50 +0000 Subject: [PATCH] LibWeb/XHR: Fix blob type in XMLHttpRequest::response() The type attribute of a blob is supposed to be a complete mime type of the form "type/subtype", not just the determined mime type's type. --- Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 8ddda865a8..fc50bb99d5 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling - * Copyright (c) 2021-2022, Linus Groh + * Copyright (c) 2021-2023, Linus Groh * Copyright (c) 2022, Luke Wilde * Copyright (c) 2022, Ali Mohammad Pur * Copyright (c) 2022-2023, Kenneth Myhra @@ -161,7 +161,7 @@ WebIDL::ExceptionOr XMLHttpRequest::response() } // 6. Otherwise, if this’s response type is "blob", set this’s response object to a new Blob object representing this’s received bytes with type set to the result of get a final MIME type for this. else if (m_response_type == Bindings::XMLHttpRequestResponseType::Blob) { - auto mime_type_as_string = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(get_final_mime_type().type())); + auto mime_type_as_string = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(get_final_mime_type().serialized())); auto blob_part = TRY(FileAPI::Blob::create(realm(), m_received_bytes, move(mime_type_as_string))); auto blob = TRY(FileAPI::Blob::create(realm(), Vector { JS::make_handle(*blob_part) })); m_response_object = JS::Value(blob.ptr());