1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/FileReader.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + * 1.9 + * The origin of this IDL file is 1.10 + * http://dev.w3.org/2006/webapi/FileAPI/#dfn-filereader 1.11 + * 1.12 + * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C 1.13 + * liability, trademark and document use rules apply. 1.14 + */ 1.15 + 1.16 +[Constructor] 1.17 +interface FileReader : EventTarget { 1.18 + // async read methods 1.19 + [Throws] 1.20 + void readAsArrayBuffer(Blob blob); 1.21 + [Throws] 1.22 + void readAsText(Blob blob, optional DOMString label = ""); 1.23 + [Throws] 1.24 + void readAsDataURL(Blob blob); 1.25 + 1.26 + [Throws] 1.27 + void abort(); 1.28 + 1.29 + // states 1.30 + const unsigned short EMPTY = 0; 1.31 + const unsigned short LOADING = 1; 1.32 + const unsigned short DONE = 2; 1.33 + 1.34 + 1.35 + readonly attribute unsigned short readyState; 1.36 + 1.37 + // File or Blob data 1.38 + // bug 858217: readonly attribute (DOMString or ArrayBuffer)? result; 1.39 + [Throws] 1.40 + readonly attribute any result; 1.41 + 1.42 + readonly attribute DOMError? error; 1.43 + 1.44 + // event handler attributes 1.45 + attribute EventHandler onloadstart; 1.46 + attribute EventHandler onprogress; 1.47 + attribute EventHandler onload; 1.48 + attribute EventHandler onabort; 1.49 + attribute EventHandler onerror; 1.50 + attribute EventHandler onloadend; 1.51 +}; 1.52 + 1.53 +// Mozilla extensions. 1.54 +partial interface FileReader { 1.55 + [Throws] 1.56 + void readAsBinaryString(Blob filedata); 1.57 +};