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),
|
|
|
|
Exposed=(Window,Worker)]
|
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
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws=Workers]
|
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);
|
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws=Workers]
|
2012-03-31 08:42:20 +04:00
|
|
|
void abort();
|
|
|
|
|
|
|
|
// response
|
2014-05-17 04:24:37 +04:00
|
|
|
readonly attribute DOMString responseURL;
|
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws=Workers]
|
2012-03-31 08:42:20 +04:00
|
|
|
readonly attribute unsigned short status;
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2013-06-13 09:20:10 +04:00
|
|
|
readonly attribute ByteString statusText;
|
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
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws=Workers]
|
2013-06-13 09:20:10 +04:00
|
|
|
ByteString getAllResponseHeaders();
|
2012-07-14 03:29:14 +04:00
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws=Workers]
|
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
|
|
|
|
2014-07-10 22:22:46 +04:00
|
|
|
[ChromeOnly, SetterThrows=Workers]
|
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
|
|
|
|
2012-09-05 17:21:33 +04:00
|
|
|
[Throws]
|
2012-03-31 08:42:20 +04:00
|
|
|
void sendAsBinary(DOMString body);
|
2012-09-11 23:08:24 +04:00
|
|
|
[Throws, ChromeOnly]
|
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
|
|
|
};
|