2012-03-31 08:42:20 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* www.w3.org/TR/2012/WD-XMLHttpRequest-20120117/
|
|
|
|
*
|
|
|
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
|
|
|
* liability, trademark and document use rules apply.
|
|
|
|
*/
|
|
|
|
|
|
|
|
interface InputStream;
|
|
|
|
interface MozChannel;
|
|
|
|
interface IID;
|
|
|
|
|
|
|
|
enum XMLHttpRequestResponseType {
|
|
|
|
"",
|
|
|
|
"arraybuffer",
|
|
|
|
"blob",
|
|
|
|
"document",
|
|
|
|
"json",
|
|
|
|
"text",
|
|
|
|
|
|
|
|
// Mozilla-specific stuff
|
|
|
|
"moz-chunked-text",
|
|
|
|
"moz-chunked-arraybuffer",
|
|
|
|
"moz-blob"
|
|
|
|
};
|
|
|
|
|
2012-06-21 11:21:55 +04:00
|
|
|
/**
|
|
|
|
* Parameters for instantiating an XMLHttpRequest. They are passed as an
|
|
|
|
* optional argument to the constructor:
|
|
|
|
*
|
|
|
|
* new XMLHttpRequest({anon: true, system: true});
|
|
|
|
*/
|
|
|
|
dictionary MozXMLHttpRequestParameters
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* If true, the request will be sent without cookie and authentication
|
|
|
|
* headers.
|
|
|
|
*/
|
|
|
|
boolean mozAnon = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, the same origin policy will not be enforced on the request.
|
|
|
|
*/
|
|
|
|
boolean mozSystem = false;
|
|
|
|
};
|
|
|
|
|
2012-09-07 19:07:12 +04:00
|
|
|
[Constructor(optional MozXMLHttpRequestParameters params),
|
|
|
|
// There are apparently callers, specifically CoffeeScript, who do
|
|
|
|
// things like this:
|
|
|
|
// c = new(window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP")
|
|
|
|
// To handle that, we need a constructor that takes a string.
|
2014-08-05 06:20:34 +04:00
|
|
|
Constructor(DOMString ignored),
|
2015-10-20 07:26:44 +03:00
|
|
|
Exposed=(Window,DedicatedWorker,SharedWorker)]
|
2012-03-31 08:42:20 +04:00
|
|
|
interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
|
|
|
// event handler
|
2012-10-10 23:53:02 +04:00
|
|
|
attribute EventHandler onreadystatechange;
|
2012-03-31 08:42:20 +04:00
|
|
|
|
|
|
|
// states
|
|
|
|
const unsigned short UNSENT = 0;
|
|
|
|
const unsigned short OPENED = 1;
|
|
|
|
const unsigned short HEADERS_RECEIVED = 2;
|
|
|
|
const unsigned short LOADING = 3;
|
|
|
|
const unsigned short DONE = 4;
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2012-03-31 08:42:20 +04:00
|
|
|
readonly attribute unsigned short readyState;
|
|
|
|
|
|
|
|
// request
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2013-10-11 20:28:24 +04:00
|
|
|
void open(ByteString method, DOMString url);
|
|
|
|
[Throws]
|
|
|
|
void open(ByteString method, DOMString url, boolean async,
|
2012-03-31 08:42:20 +04:00
|
|
|
optional DOMString? user, optional DOMString? password);
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2013-06-13 09:20:10 +04:00
|
|
|
void setRequestHeader(ByteString header, ByteString value);
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[SetterThrows]
|
2012-03-31 08:42:20 +04:00
|
|
|
attribute unsigned long timeout;
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2012-11-28 00:20:40 +04:00
|
|
|
[SetterThrows]
|
2012-03-31 08:42:20 +04:00
|
|
|
attribute boolean withCredentials;
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2016-06-27 20:13:41 +03:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
readonly attribute XMLHttpRequestUpload upload;
|
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void send();
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void send(ArrayBuffer data);
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-12-20 05:47:39 +04:00
|
|
|
void send(ArrayBufferView data);
|
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void send(Blob data);
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void send(Document data);
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void send(DOMString? data);
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void send(FormData data);
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void send(InputStream data);
|
2016-07-11 22:03:44 +03:00
|
|
|
[Throws]
|
|
|
|
void send(URLSearchParams data);
|
2012-03-31 08:42:20 +04:00
|
|
|
|
2016-06-27 20:13:41 +03:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void abort();
|
|
|
|
|
|
|
|
// response
|
2014-05-17 04:24:37 +04:00
|
|
|
readonly attribute DOMString responseURL;
|
|
|
|
|
2016-06-27 20:13:41 +03:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
readonly attribute unsigned short status;
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2016-06-27 20:13:41 +03:00
|
|
|
[Throws]
|
2013-06-13 09:20:10 +04:00
|
|
|
readonly attribute ByteString statusText;
|
2016-06-27 20:13:41 +03:00
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2013-06-13 09:20:10 +04:00
|
|
|
ByteString? getResponseHeader(ByteString header);
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2016-06-27 20:13:41 +03:00
|
|
|
[Throws]
|
2013-06-13 09:20:10 +04:00
|
|
|
ByteString getAllResponseHeaders();
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2016-06-14 04:56:15 +03:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void overrideMimeType(DOMString mime);
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[SetterThrows]
|
2012-03-31 08:42:20 +04:00
|
|
|
attribute XMLHttpRequestResponseType responseType;
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
readonly attribute any response;
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
readonly attribute DOMString? responseText;
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2014-08-05 06:20:34 +04:00
|
|
|
[Throws, Exposed=Window]
|
2012-03-31 08:42:20 +04:00
|
|
|
readonly attribute Document? responseXML;
|
|
|
|
|
|
|
|
// Mozilla-specific stuff
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2016-06-27 20:13:41 +03:00
|
|
|
[ChromeOnly, SetterThrows]
|
2012-03-31 08:42:20 +04:00
|
|
|
attribute boolean mozBackgroundRequest;
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2014-08-05 06:20:34 +04:00
|
|
|
[ChromeOnly, Exposed=Window]
|
2012-09-11 23:08:24 +04:00
|
|
|
readonly attribute MozChannel? channel;
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2015-03-03 04:09:07 +03:00
|
|
|
// A platform-specific identifer to represent the network interface
|
|
|
|
// which the HTTP request would occur on.
|
|
|
|
[ChromeOnly, Exposed=Window]
|
|
|
|
attribute ByteString? networkInterfaceId;
|
|
|
|
|
2015-02-09 19:42:27 +03:00
|
|
|
[Throws, ChromeOnly, Exposed=Window]
|
2012-03-31 08:42:20 +04:00
|
|
|
any getInterface(IID iid);
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
readonly attribute boolean mozAnon;
|
|
|
|
readonly attribute boolean mozSystem;
|
2012-03-31 08:42:20 +04:00
|
|
|
};
|