1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-24 08:09:08 -05:00

fix(ext/fetch): resolve TODOs about WebIDL conversions in body init (#15312)

This commit is contained in:
Phosra 2022-07-28 04:18:17 -07:00 committed by GitHub
parent 5d263c932f
commit 519ed44ebb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -452,15 +452,13 @@
webidl.converters["BodyInit_DOMString"] = (V, opts) => {
// Union for (ReadableStream or Blob or ArrayBufferView or ArrayBuffer or FormData or URLSearchParams or USVString)
if (ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, V)) {
// TODO(lucacasonato): ReadableStream is not branded
return V;
return webidl.converters["ReadableStream"](V, opts);
} else if (ObjectPrototypeIsPrototypeOf(BlobPrototype, V)) {
return webidl.converters["Blob"](V, opts);
} else if (ObjectPrototypeIsPrototypeOf(FormDataPrototype, V)) {
return webidl.converters["FormData"](V, opts);
} else if (ObjectPrototypeIsPrototypeOf(URLSearchParamsPrototype, V)) {
// TODO(lucacasonato): URLSearchParams is not branded
return V;
return webidl.converters["URLSearchParams"](V, opts);
}
if (typeof V === "object") {
if (

View file

@ -300,6 +300,11 @@
webidl.configurePrototype(URLSearchParams);
const URLSearchParamsPrototype = URLSearchParams.prototype;
webidl.converters["URLSearchParams"] = webidl.createInterfaceConverter(
"URLSearchParams",
URLSearchParamsPrototype,
);
const _url = Symbol("url");
class URL {