1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * The origin of this IDL file is
7 * http://fetch.spec.whatwg.org/
8 */
9
10typedef object JSON;
11typedef (Blob or BufferSource or FormData or URLSearchParams or USVString or ReadableStream) BodyInit;
12
13[Exposed=(Window,Worker)]
14interface mixin Body {
15  readonly attribute boolean bodyUsed;
16  [Throws]
17  Promise<ArrayBuffer> arrayBuffer();
18  [Throws]
19  Promise<Blob> blob();
20  [Throws]
21  Promise<FormData> formData();
22  [Throws]
23  Promise<JSON> json();
24  [Throws]
25  Promise<USVString> text();
26  readonly attribute ReadableStream? body;
27};
28
29// These are helper dictionaries for the parsing of a
30// getReader().read().then(data) parsing.
31// See more about how these 2 helpers are used in
32// dom/fetch/FetchStreamReader.cpp
33dictionary FetchReadableStreamReadDataDone {
34  boolean done = false;
35};
36
37dictionary FetchReadableStreamReadDataArray {
38  Uint8Array value;
39};
40