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/.
6 * The origin of this IDL file is
7 * www.w3.org/TR/2012/WD-XMLHttpRequest-20120117/
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
14 interface InputStream;
18 enum XMLHttpRequestResponseType {
26 // Mozilla-specific stuff
28 "moz-chunked-arraybuffer",
33 * Parameters for instantiating an XMLHttpRequest. They are passed as an
34 * optional argument to the constructor:
36 * new XMLHttpRequest({anon: true, system: true});
38 dictionary MozXMLHttpRequestParameters
41 * If true, the request will be sent without cookie and authentication
44 boolean mozAnon = false;
47 * If true, the same origin policy will not be enforced on the request.
49 boolean mozSystem = false;
52 [Constructor(optional MozXMLHttpRequestParameters params),
53 // There are apparently callers, specifically CoffeeScript, who do
55 // c = new(window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP")
56 // To handle that, we need a constructor that takes a string.
57 Constructor(DOMString ignored),
58 Exposed=(Window,Worker)]
59 interface XMLHttpRequest : XMLHttpRequestEventTarget {
61 attribute EventHandler onreadystatechange;
64 const unsigned short UNSENT = 0;
65 const unsigned short OPENED = 1;
66 const unsigned short HEADERS_RECEIVED = 2;
67 const unsigned short LOADING = 3;
68 const unsigned short DONE = 4;
70 readonly attribute unsigned short readyState;
74 void open(ByteString method, DOMString url);
76 void open(ByteString method, DOMString url, boolean async,
77 optional DOMString? user, optional DOMString? password);
79 void setRequestHeader(ByteString header, ByteString value);
82 attribute unsigned long timeout;
85 attribute boolean withCredentials;
88 readonly attribute XMLHttpRequestUpload upload;
93 void send(ArrayBuffer data);
95 void send(ArrayBufferView data);
99 void send(Document data);
101 void send(DOMString? data);
103 void send(FormData data);
105 void send(InputStream data);
111 readonly attribute DOMString responseURL;
114 readonly attribute unsigned short status;
116 readonly attribute ByteString statusText;
118 ByteString? getResponseHeader(ByteString header);
121 ByteString getAllResponseHeaders();
124 void overrideMimeType(DOMString mime);
127 attribute XMLHttpRequestResponseType responseType;
129 readonly attribute any response;
131 readonly attribute DOMString? responseText;
133 [Throws, Exposed=Window]
134 readonly attribute Document? responseXML;
136 // Mozilla-specific stuff
138 [ChromeOnly, SetterThrows=Workers]
139 attribute boolean mozBackgroundRequest;
141 [ChromeOnly, Exposed=Window]
142 readonly attribute MozChannel? channel;
145 void sendAsBinary(DOMString body);
147 any getInterface(IID iid);
149 readonly attribute boolean mozAnon;
150 readonly attribute boolean mozSystem;