
This makes XHR now rely on Fetch, which allows it to correct send Origin and Referer headers, CORS-preflight and filtering and many other goodies. The main thing that's missing is Streams, which means we can't properly produce progress events or switch to the Loading ready state. This also doesn't implement the Document responseType just yet.
50 lines
1.6 KiB
Text
50 lines
1.6 KiB
Text
#import <DOM/Document.idl>
|
|
#import <DOM/EventHandler.idl>
|
|
#import <Fetch/BodyInit.idl>
|
|
#import <XHR/XMLHttpRequestEventTarget.idl>
|
|
#import <XHR/XMLHttpRequestUpload.idl>
|
|
|
|
enum XMLHttpRequestResponseType {
|
|
"",
|
|
"arraybuffer",
|
|
"blob",
|
|
"document",
|
|
"json",
|
|
"text"
|
|
};
|
|
|
|
// https://xhr.spec.whatwg.org/#xmlhttprequest
|
|
[Exposed=(Window,DedicatedWorker,SharedWorker), UseNewAKString]
|
|
interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
|
|
|
constructor();
|
|
|
|
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;
|
|
|
|
readonly attribute unsigned short readyState;
|
|
readonly attribute unsigned short status;
|
|
readonly attribute ByteString statusText;
|
|
readonly attribute DOMString responseText;
|
|
readonly attribute any response;
|
|
attribute XMLHttpRequestResponseType responseType;
|
|
attribute unsigned long timeout;
|
|
attribute boolean withCredentials;
|
|
[SameObject] readonly attribute XMLHttpRequestUpload upload;
|
|
|
|
undefined open(DOMString method, DOMString url);
|
|
undefined open(ByteString method, USVString url, boolean async, optional USVString? username = null, optional USVString? password = null);
|
|
undefined setRequestHeader(DOMString name, DOMString value);
|
|
undefined send(optional (Document or XMLHttpRequestBodyInit)? body = null);
|
|
undefined abort();
|
|
|
|
ByteString? getResponseHeader(ByteString name);
|
|
ByteString getAllResponseHeaders();
|
|
undefined overrideMimeType(DOMString mime);
|
|
|
|
attribute EventHandler onreadystatechange;
|
|
|
|
};
|