integrate readablestream with fetch and blob

This commit is contained in:
Gregory Terzian 2020-02-29 11:59:10 +08:00
parent 0281acea95
commit bd5796c90b
74 changed files with 2219 additions and 899 deletions

View file

@ -17,6 +17,7 @@ interface Blob {
optional [Clamp] long long end,
optional DOMString contentType);
[NewObject] object stream();
[NewObject] Promise<DOMString> text();
[NewObject] Promise<ArrayBuffer> arrayBuffer();
};

View file

@ -7,6 +7,7 @@
[Exposed=(Window,Worker)]
interface mixin Body {
readonly attribute boolean bodyUsed;
readonly attribute object? body;
[NewObject] Promise<ArrayBuffer> arrayBuffer();
[NewObject] Promise<Blob> blob();

View file

@ -0,0 +1,11 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// This interface is entirely internal to Servo, and should not be accessible to
// web pages.
[NoInterfaceObject, Exposed=(Window,Worker)]
// Need to escape "ReadableStream" so it's treated as an identifier.
interface _ReadableStream {
};

View file

@ -13,7 +13,7 @@
*/
// https://fetch.spec.whatwg.org/#bodyinit
typedef (Blob or BufferSource or FormData or DOMString or URLSearchParams) BodyInit;
typedef (Blob or BufferSource or FormData or DOMString or URLSearchParams or ReadableStream) BodyInit;
enum XMLHttpRequestResponseType {
"",
@ -21,7 +21,7 @@ enum XMLHttpRequestResponseType {
"blob",
"document",
"json",
"text"
"text",
};
[Exposed=(Window,Worker)]