summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl
blob: a0943b18bae5096dfd3e6e1f88dd835cb8f1209c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#import <DOM/Document.idl>
#import <DOM/EventHandler.idl>
#import <Fetch/BodyInit.idl>
#import <XHR/XMLHttpRequestEventTarget.idl>

enum XMLHttpRequestResponseType {
  "",
  "arraybuffer",
  "blob",
  "document",
  "json",
  "text"
};

// https://xhr.spec.whatwg.org/#xmlhttprequest
[Exposed=(Window,DedicatedWorker,SharedWorker)]
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 DOMString responseText;
    readonly attribute any response;
    attribute XMLHttpRequestResponseType responseType;
    attribute unsigned long timeout;

    undefined open(DOMString method, DOMString url);
    undefined open(ByteString method, USVString url, boolean async, optional USVString? username = {}, optional USVString? password = {});
    undefined setRequestHeader(DOMString name, DOMString value);
    undefined send(optional (Document or XMLHttpRequestBodyInit)? body = null);

    ByteString? getResponseHeader(ByteString name);
    ByteString getAllResponseHeaders();
    undefined overrideMimeType(DOMString mime);

    attribute EventHandler onreadystatechange;

};