Index: core/xmlhttprequest/XMLHttpRequest.idl |
diff --git a/core/xml/XMLHttpRequest.idl b/core/xmlhttprequest/XMLHttpRequest.idl |
similarity index 67% |
rename from core/xml/XMLHttpRequest.idl |
rename to core/xmlhttprequest/XMLHttpRequest.idl |
index 4facb562003920c931cde7aabec527290f754f31..da146641808b683f4ec87a0a21dfa82661a7cfe6 100644 |
--- a/core/xml/XMLHttpRequest.idl |
+++ b/core/xmlhttprequest/XMLHttpRequest.idl |
@@ -26,6 +26,8 @@ |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
+// https://xhr.spec.whatwg.org/#interface-xmlhttprequest |
+ |
enum XMLHttpRequestResponseType { |
"", |
"arraybuffer", |
@@ -34,60 +36,51 @@ enum XMLHttpRequestResponseType { |
"json", |
"text", |
"legacystream", |
- "stream" |
}; |
+// TODO(philipj): Most DOMString types in the XMLHttpRequest interface should be |
+// either ByteString or USVString. |
[ |
- WillBeGarbageCollected, |
ActiveDOMObject, |
- CustomConstructor(optional XMLHttpRequestOptions options), |
+ Constructor, |
+ ConstructorCallWith=ScriptState, |
+ // TODO(philipj): The spec has Exposed=(Window,Worker) |
+ // https://github.com/whatwg/xhr/issues/19 |
Exposed=(Window,DedicatedWorker,SharedWorker) |
] interface XMLHttpRequest : XMLHttpRequestEventTarget { |
- // event handler attributes |
+ // event handler |
attribute EventHandler onreadystatechange; |
- // state |
+ // 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; |
- |
- [RaisesException=Setter] attribute unsigned long timeout; |
readonly attribute unsigned short readyState; |
+ // request |
+ [RaisesException] void open(DOMString method, DOMString url); |
+ [RaisesException] void open(DOMString method, DOMString url, boolean async, optional DOMString? username = null, optional DOMString? password = null); |
+ [RaisesException] void setRequestHeader(DOMString name, DOMString value); |
+ [RaisesException=Setter] attribute unsigned long timeout; |
[RaisesException=Setter] attribute boolean withCredentials; |
- |
- [Custom, RaisesException] void open(DOMString method, DOMString url, optional boolean async, optional DOMString user, optional DOMString password); |
- |
- [RaisesException] void setRequestHeader(DOMString header, DOMString value); |
- |
- [Custom, RaisesException] void send(); |
- // FIXMEDART: send(ArrayBuffer data) should be eventually deprecated. |
- [DartCustom=New] void send(ArrayBuffer data); |
- [DartCustom=New] void send(ArrayBufferView data); |
- [DartCustom=New] void send(Blob data); |
- [DartCustom=New] void send(Document data); |
- [DartCustom=New] void send(DOMString data); |
- [DartCustom=New] void send(FormData data); |
- |
- void abort(); |
- |
readonly attribute XMLHttpRequestUpload upload; |
+ // TODO(philipj): The data argument should be of type |
+ // (Document or BodyInit)? |
+ [RaisesException] void send(optional (ArrayBuffer or ArrayBufferView or Blob or Document or DOMString or FormData)? body = null); |
+ void abort(); |
// response |
- [TreatReturnedNullStringAs=Undefined] DOMString getAllResponseHeaders(); |
- DOMString? getResponseHeader(DOMString header); |
- [Custom=Getter, RaisesException=Getter] readonly attribute DOMString? responseText; |
- [RaisesException=Getter] readonly attribute Document responseXML; |
- |
- [RaisesException=Setter] attribute XMLHttpRequestResponseType responseType; |
- [Custom=Getter, RaisesException=Getter] readonly attribute object response; |
readonly attribute DOMString responseURL; |
- |
readonly attribute unsigned short status; |
readonly attribute DOMString statusText; |
- |
- // Extension |
- [RaisesException] void overrideMimeType(DOMString override); |
+ DOMString? getResponseHeader(DOMString name); |
+ DOMString getAllResponseHeaders(); |
+ [RaisesException] void overrideMimeType(DOMString mime); |
+ [RaisesException=Setter] attribute XMLHttpRequestResponseType responseType; |
+ [Custom=Getter, RaisesException=Getter] readonly attribute any response; |
+ [Custom=Getter, RaisesException=Getter] readonly attribute DOMString responseText; |
+ // TODO(philipj): responseXML should be [Exposed=Window]. |
+ [RaisesException=Getter] readonly attribute Document? responseXML; |
}; |