diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 2ce8098312..9bd319bd1c 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -283,6 +284,11 @@ static ErrorOr extract_body(XMLHttpRequestB type = blob->type().to_byte_buffer(); return {}; }, + [&](JS::Handle const& buffer_source) -> ErrorOr { + // Set source to a copy of the bytes held by object. + source = TRY(Bindings::IDL::get_buffer_source_copy(*buffer_source.cell())); + return {}; + }, [&](NonnullRefPtr const& url_search_params) -> ErrorOr { // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list. source = url_search_params->to_string().to_byte_buffer(); diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h index 2470323855..4380441417 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h @@ -24,7 +24,7 @@ namespace Web::XHR { // https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit -using XMLHttpRequestBodyInit = Variant, NonnullRefPtr, String>; +using XMLHttpRequestBodyInit = Variant, JS::Handle, NonnullRefPtr, String>; class XMLHttpRequest final : public RefCounted diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl index 874006ea25..fa6b29a0c8 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl @@ -3,7 +3,7 @@ #import #import -typedef (Blob or URLSearchParams or USVString) XMLHttpRequestBodyInit; +typedef (Blob or BufferSource or URLSearchParams or USVString) XMLHttpRequestBodyInit; enum XMLHttpRequestResponseType { "",