From 8f5620b5d91f0a6fee9d0e4a6623379d53adde72 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 22 Sep 2022 00:10:41 +0100 Subject: [PATCH] LibWeb: Add BodyInit union type --- Userland/Libraries/LibWeb/Fetch/BodyInit.h | 3 +++ Userland/Libraries/LibWeb/Fetch/BodyInit.idl | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.h b/Userland/Libraries/LibWeb/Fetch/BodyInit.h index 24dc2f244c..cd2be22857 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.h +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.h @@ -16,6 +16,9 @@ namespace Web::Fetch { // https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit using XMLHttpRequestBodyInit = Variant, JS::Handle, JS::Handle, String>; +// https://fetch.spec.whatwg.org/#bodyinit +using BodyInit = Variant, JS::Handle, JS::Handle, JS::Handle, String>; + ErrorOr extract_body(JS::Realm&, XMLHttpRequestBodyInit const&); } diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.idl b/Userland/Libraries/LibWeb/Fetch/BodyInit.idl index 15f001a8a8..d57d42bffb 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.idl +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.idl @@ -1,5 +1,11 @@ #import +#import #import // https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit typedef (Blob or BufferSource or URLSearchParams or USVString) XMLHttpRequestBodyInit; + +// https://fetch.spec.whatwg.org/#bodyinit +// FIXME: IDLParser doesn't resolve nested unions properly +// typedef (ReadableStream or XMLHttpRequestBodyInit) BodyInit; +typedef (ReadableStream or Blob or BufferSource or URLSearchParams or USVString) BodyInit;