1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:57:44 +00:00

LibWeb: Add FormData support to XHR

This adds FormData support to XHR so that it can post
multipart/form-data encoded data.
This commit is contained in:
Kenneth Myhra 2023-04-02 22:30:56 +02:00 committed by Linus Groh
parent 5df4d66d91
commit 1120011de4
5 changed files with 24 additions and 7 deletions

View file

@ -1,6 +1,10 @@
#import <FileAPI/Blob.idl>
#import <FileAPI/File.idl>
#import <HTML/HTMLFormElement.idl>
// FIXME: This #import currently gives the following error after XHR/FormData.idl was #imported in Fetch/BodyInit.idl:
// "LibWeb/HTML/Window.idl:114: error: Mixin 'WindowOrWorkerGlobalScope' was never defined."
// XHR/FormData.idl needs to be #imported in Fetch/BodyInit.idl while removing #import HTML/HTMLFormElement.idl
// currently makes no difference.
// #import <HTML/HTMLFormElement.idl>
typedef (File or USVString) FormDataEntryValue;

View file

@ -26,7 +26,7 @@
namespace Web::XHR {
// https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit
using DocumentOrXMLHttpRequestBodyInit = Variant<JS::Handle<Web::DOM::Document>, JS::Handle<Web::FileAPI::Blob>, JS::Handle<JS::Object>, JS::Handle<Web::URL::URLSearchParams>, AK::String>;
using DocumentOrXMLHttpRequestBodyInit = Variant<JS::Handle<Web::DOM::Document>, JS::Handle<Web::FileAPI::Blob>, JS::Handle<JS::Object>, JS::Handle<XHR::FormData>, JS::Handle<Web::URL::URLSearchParams>, AK::String>;
class XMLHttpRequest final : public XMLHttpRequestEventTarget {
WEB_PLATFORM_OBJECT(XMLHttpRequest, XMLHttpRequestEventTarget);