2012-03-31 04:42:20 +00: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 Blob;
|
|
|
|
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 07:21:55 +00: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 15:07:12 +00: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.
|
|
|
|
Constructor(DOMString ignored)]
|
2012-03-31 04:42:20 +00:00
|
|
|
interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
|
|
|
// event handler
|
2012-10-10 19:53:02 +00:00
|
|
|
attribute EventHandler onreadystatechange;
|
2012-03-31 04:42:20 +00: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-13 23:29:14 +00:00
|
|
|
|
2012-03-31 04:42:20 +00:00
|
|
|
readonly attribute unsigned short readyState;
|
|
|
|
|
|
|
|
// request
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2013-10-11 16:28:24 +00:00
|
|
|
void open(ByteString method, DOMString url);
|
|
|
|
[Throws]
|
|
|
|
void open(ByteString method, DOMString url, boolean async,
|
2012-03-31 04:42:20 +00:00
|
|
|
optional DOMString? user, optional DOMString? password);
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2013-06-13 05:20:10 +00:00
|
|
|
void setRequestHeader(ByteString header, ByteString value);
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[SetterThrows]
|
2012-03-31 04:42:20 +00:00
|
|
|
attribute unsigned long timeout;
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-11-27 20:20:40 +00:00
|
|
|
[SetterThrows]
|
2012-03-31 04:42:20 +00:00
|
|
|
attribute boolean withCredentials;
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws=Workers]
|
2012-03-31 04:42:20 +00:00
|
|
|
readonly attribute XMLHttpRequestUpload upload;
|
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
void send();
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
void send(ArrayBuffer data);
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-12-20 01:47:39 +00:00
|
|
|
void send(ArrayBufferView data);
|
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
void send(Blob data);
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
void send(Document data);
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
void send(DOMString? data);
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
void send(FormData data);
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
void send(InputStream data);
|
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws=Workers]
|
2012-03-31 04:42:20 +00:00
|
|
|
void abort();
|
|
|
|
|
|
|
|
// response
|
2014-05-17 00:24:37 +00:00
|
|
|
readonly attribute DOMString responseURL;
|
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws=Workers]
|
2012-03-31 04:42:20 +00:00
|
|
|
readonly attribute unsigned short status;
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2013-06-13 05:20:10 +00:00
|
|
|
readonly attribute ByteString statusText;
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2013-06-13 05:20:10 +00:00
|
|
|
ByteString? getResponseHeader(ByteString header);
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws=Workers]
|
2013-06-13 05:20:10 +00:00
|
|
|
ByteString getAllResponseHeaders();
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws=Workers]
|
2012-03-31 04:42:20 +00:00
|
|
|
void overrideMimeType(DOMString mime);
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[SetterThrows]
|
2012-03-31 04:42:20 +00:00
|
|
|
attribute XMLHttpRequestResponseType responseType;
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
readonly attribute any response;
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
readonly attribute DOMString? responseText;
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws=MainThread]
|
2012-03-31 04:42:20 +00:00
|
|
|
readonly attribute Document? responseXML;
|
|
|
|
|
|
|
|
// Mozilla-specific stuff
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2014-07-10 18:22:46 +00:00
|
|
|
[ChromeOnly, SetterThrows=Workers]
|
2012-03-31 04:42:20 +00:00
|
|
|
attribute boolean mozBackgroundRequest;
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[ChromeOnly]
|
2012-09-11 19:08:24 +00:00
|
|
|
readonly attribute MozChannel? channel;
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-09-05 13:21:33 +00:00
|
|
|
[Throws]
|
2012-03-31 04:42:20 +00:00
|
|
|
void sendAsBinary(DOMString body);
|
2012-09-11 19:08:24 +00:00
|
|
|
[Throws, ChromeOnly]
|
2012-03-31 04:42:20 +00:00
|
|
|
any getInterface(IID iid);
|
2012-07-13 23:29:14 +00:00
|
|
|
|
2012-06-10 23:44:50 +00:00
|
|
|
readonly attribute boolean mozAnon;
|
|
|
|
readonly attribute boolean mozSystem;
|
2012-03-31 04:42:20 +00:00
|
|
|
};
|