2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-03-31 08:42:20 +04:00
|
|
|
/* 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
|
2017-08-25 16:30:33 +03:00
|
|
|
* https://xhr.spec.whatwg.org/#interface-xmlhttprequest
|
2012-03-31 08:42:20 +04:00
|
|
|
*
|
|
|
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
|
|
|
* liability, trademark and document use rules apply.
|
|
|
|
*/
|
|
|
|
|
|
|
|
interface InputStream;
|
|
|
|
interface MozChannel;
|
|
|
|
|
|
|
|
enum XMLHttpRequestResponseType {
|
|
|
|
"",
|
|
|
|
"arraybuffer",
|
|
|
|
"blob",
|
|
|
|
"document",
|
|
|
|
"json",
|
|
|
|
"text",
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2019-07-03 10:52:35 +03:00
|
|
|
[Constructor(optional MozXMLHttpRequestParameters params = {}),
|
2012-09-07 19:07:12 +04:00
|
|
|
// 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]
|
2017-01-24 11:23:11 +03:00
|
|
|
void open(ByteString method, USVString url);
|
2013-10-11 20:28:24 +04:00
|
|
|
[Throws]
|
2017-01-24 11:23:11 +03:00
|
|
|
void open(ByteString method, USVString url, boolean async,
|
|
|
|
optional USVString? user=null, optional USVString? password=null);
|
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]
|
2017-08-25 16:30:33 +03:00
|
|
|
void send(optional (Document or BodyInit)? body = null);
|
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
|
2017-01-24 11:23:11 +03:00
|
|
|
readonly attribute USVString responseURL;
|
2014-05-17 04:24:37 +04:00
|
|
|
|
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;
|
2016-09-12 10:05:42 +03:00
|
|
|
[Cached, Pure, Throws]
|
2017-01-24 11:23:11 +03:00
|
|
|
readonly attribute USVString? 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-02-09 19:42:27 +03:00
|
|
|
[Throws, ChromeOnly, Exposed=Window]
|
2018-07-18 07:30:38 +03:00
|
|
|
any getInterface(any iid);
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2016-07-06 07:06:25 +03:00
|
|
|
[ChromeOnly, Exposed=Window]
|
2019-07-03 10:52:35 +03:00
|
|
|
void setOriginAttributes(optional OriginAttributesDictionary originAttributes = {});
|
2016-07-06 07:06:25 +03:00
|
|
|
|
2017-08-25 16:31:15 +03:00
|
|
|
[ChromeOnly, Throws]
|
|
|
|
void sendInputStream(InputStream body);
|
|
|
|
|
2017-05-24 15:52:15 +03:00
|
|
|
// Only works on MainThread.
|
|
|
|
// Its permanence is to be evaluated in bug 1368540 for Firefox 60.
|
|
|
|
[ChromeOnly]
|
|
|
|
readonly attribute unsigned short errorCode;
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
readonly attribute boolean mozAnon;
|
|
|
|
readonly attribute boolean mozSystem;
|
2012-03-31 08:42:20 +04:00
|
|
|
};
|