Bug 1899500 - Implement explicit resource management in Baseline compiler. r=arai
[gecko.git] / dom / webidl / Blob.webidl
blobb27a72eef4cb6b4945b6904039359ee20d852a67
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  * https://w3c.github.io/FileAPI/#blob
8  *
9  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10  * liability, trademark and document use rules apply.
11  */
13 typedef (BufferSource or Blob or UTF8String) BlobPart;
15 [Exposed=(Window,Worker)]
16 interface Blob {
17   [Throws]
18   constructor(optional sequence<BlobPart> blobParts,
19               optional BlobPropertyBag options = {});
21   [GetterThrows]
22   readonly attribute unsigned long long size;
24   readonly attribute DOMString type;
26   //slice Blob into byte-ranged chunks
28   [Throws]
29   Blob slice(optional [Clamp] long long start,
30              optional [Clamp] long long end,
31              optional DOMString contentType);
33   // read from the Blob.
34   [NewObject, Throws] ReadableStream stream();
35   [NewObject] Promise<USVString> text();
36   [NewObject] Promise<ArrayBuffer> arrayBuffer();
37   [NewObject] Promise<Uint8Array> bytes();
40 enum EndingType { "transparent", "native" };
42 dictionary BlobPropertyBag {
43   DOMString type = "";
44   EndingType endings = "transparent";
47 partial interface Blob {
48   // This returns the type of BlobImpl used for this Blob.
49   [ChromeOnly]
50   readonly attribute DOMString blobImplType;