LibWeb/XHR: Ensure type set on blob responses

This commit is contained in:
David Hewitt 2025-02-13 23:23:47 +09:00 committed by Tim Ledbetter
commit be3e221b3f
Notes: github-actions[bot] 2025-02-16 19:09:45 +00:00
4 changed files with 533 additions and 2 deletions

View file

@ -217,8 +217,7 @@ WebIDL::ExceptionOr<JS::Value> XMLHttpRequest::response()
// 6. Otherwise, if thiss response type is "blob", set thiss response object to a new Blob object representing thiss 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 = get_final_mime_type().serialized();
auto blob_part = FileAPI::Blob::create(realm(), m_received_bytes, move(mime_type_as_string));
auto blob = FileAPI::Blob::create(realm(), Vector<FileAPI::BlobPart> { GC::make_root(*blob_part) });
auto blob = FileAPI::Blob::create(realm(), m_received_bytes, move(mime_type_as_string));
m_response_object = GC::Ref<JS::Object> { blob };
}
// 7. Otherwise, if thiss response type is "document", set a document response for this.