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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<!doctype html>
<meta charset=utf-8>
<title>XMLHttpRequest IDL tests</title>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<script type=text/plain class=untested>
interface EventTarget {
void addEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
void removeEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
boolean dispatchEvent(Event event);
};
</script>
<script type=text/plain>
[NoInterfaceObject]
interface XMLHttpRequestEventTarget : EventTarget {
// event handlers
[TreatNonCallableAsNull] attribute Function? onloadstart;
[TreatNonCallableAsNull] attribute Function? onprogress;
[TreatNonCallableAsNull] attribute Function? onabort;
[TreatNonCallableAsNull] attribute Function? onerror;
[TreatNonCallableAsNull] attribute Function? onload;
[TreatNonCallableAsNull] attribute Function? ontimeout;
[TreatNonCallableAsNull] attribute Function? onloadend;
};
interface XMLHttpRequestUpload : XMLHttpRequestEventTarget {
};
/*
enum XMLHttpRequestResponseType {
"",
"arraybuffer",
"blob",
"document",
"json",
"text"
};
*/
[Constructor]
interface XMLHttpRequest : XMLHttpRequestEventTarget {
// event handler
[TreatNonCallableAsNull] attribute Function? onreadystatechange;
// 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;
readonly attribute unsigned short readyState;
// request
void open(DOMString method, DOMString url, optional boolean async/* = true*/, optional DOMString? user, optional DOMString? password);
void setRequestHeader(DOMString header, DOMString value);
attribute unsigned long timeout;
attribute boolean withCredentials;
readonly attribute XMLHttpRequestUpload upload;
void send(optional (ArrayBufferView or Blob or Document or DOMString or FormData)? data/* = null*/);
void abort();
// response
readonly attribute unsigned short status;
readonly attribute DOMString statusText;
DOMString? getResponseHeader(DOMString header);
DOMString getAllResponseHeaders();
void overrideMimeType(DOMString mime);
/* attribute XMLHttpRequestResponseType responseType; */
readonly attribute any response;
readonly attribute DOMString responseText;
readonly attribute Document? responseXML;
};
[Constructor,
Constructor(HTMLFormElement form)]
interface FormData {
void append(DOMString name, Blob value, optional DOMString filename);
void append(DOMString name, DOMString value);
};
</script>
<script>
"use strict";
var form = document.createElement("form");
var idlArray = new IdlArray();
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
if (node.className == "untested") {
idlArray.add_untested_idls(node.textContent);
} else {
idlArray.add_idls(node.textContent);
}
});
idlArray.add_objects({
XMLHttpRequest: ['new XMLHttpRequest()'],
XMLHttpRequestUpload: ['(new XMLHttpRequest()).upload'],
FormData: ['new FormData()', 'new FormData(form)']
});
idlArray.test();
</script>
|