OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 11 matching lines...) Expand all Loading... |
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
| 32 // https://w3c.github.io/FileAPI/#APIASynch |
| 33 |
32 [ | 34 [ |
33 GarbageCollected, | 35 GarbageCollected, |
34 ActiveDOMObject, | 36 ActiveDOMObject, |
35 Constructor, | 37 Constructor, |
36 ConstructorCallWith=ExecutionContext, | 38 ConstructorCallWith=ExecutionContext, |
37 Exposed=(Window,Worker), | 39 Exposed=(Window,Worker), |
38 TypeChecking=Interface | 40 TypeChecking=Interface |
39 ] interface FileReader : EventTarget { | 41 ] interface FileReader : EventTarget { |
40 // ready states | |
41 const unsigned short EMPTY = 0; | |
42 const unsigned short LOADING = 1; | |
43 const unsigned short DONE = 2; | |
44 readonly attribute unsigned short readyState; | |
45 | |
46 // async read methods | 42 // async read methods |
47 [RaisesException] void readAsArrayBuffer(Blob blob); | 43 [RaisesException] void readAsArrayBuffer(Blob blob); |
48 [RaisesException] void readAsBinaryString(Blob blob); | 44 // TODO(philipj): readAsBinaryString() was removed from the spec in 2012: |
49 [RaisesException] void readAsText(Blob blob, optional DOMString encoding); | 45 // https://github.com/w3c/FileAPI/commit/8cce54559dc27bf8b8244f3f0ca9fb3e4d9
6efdb |
| 46 [RaisesException, Measure] void readAsBinaryString(Blob blob); |
| 47 [RaisesException] void readAsText(Blob blob, optional DOMString label); |
50 [RaisesException] void readAsDataURL(Blob blob); | 48 [RaisesException] void readAsDataURL(Blob blob); |
51 | 49 |
52 void abort(); | 50 void abort(); |
53 | 51 |
54 // file data | 52 // states |
| 53 const unsigned short EMPTY = 0; |
| 54 const unsigned short LOADING = 1; |
| 55 const unsigned short DONE = 2; |
| 56 |
| 57 readonly attribute unsigned short readyState; |
| 58 |
| 59 // File or Blob data |
55 readonly attribute (DOMString or ArrayBuffer)? result; | 60 readonly attribute (DOMString or ArrayBuffer)? result; |
56 | 61 |
57 readonly attribute FileError error; | 62 // TODO(philipj): error should be DOMError. crbug.com/496901 |
| 63 readonly attribute FileError? error; |
58 | 64 |
| 65 // event handler attributes |
59 attribute EventHandler onloadstart; | 66 attribute EventHandler onloadstart; |
60 attribute EventHandler onprogress; | 67 attribute EventHandler onprogress; |
61 attribute EventHandler onload; | 68 attribute EventHandler onload; |
62 attribute EventHandler onabort; | 69 attribute EventHandler onabort; |
63 attribute EventHandler onerror; | 70 attribute EventHandler onerror; |
64 attribute EventHandler onloadend; | 71 attribute EventHandler onloadend; |
65 }; | 72 }; |
OLD | NEW |