diff options
Diffstat (limited to 'Source/WebCore/xml/XMLHttpRequest.idl')
-rw-r--r-- | Source/WebCore/xml/XMLHttpRequest.idl | 89 |
1 files changed, 38 insertions, 51 deletions
diff --git a/Source/WebCore/xml/XMLHttpRequest.idl b/Source/WebCore/xml/XMLHttpRequest.idl index ef1a21ae6..5daad5b01 100644 --- a/Source/WebCore/xml/XMLHttpRequest.idl +++ b/Source/WebCore/xml/XMLHttpRequest.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2008-2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -26,6 +26,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +typedef (ArrayBufferView or ArrayBuffer) BufferSource; +// FIXME: Add URLSearchParams and ReadableStream to the union when supported. +typedef (Blob or BufferSource or DOMFormData or USVString) BodyInit; + enum XMLHttpRequestResponseType { "", "arraybuffer", @@ -36,26 +40,19 @@ enum XMLHttpRequestResponseType { }; [ - GlobalContext=DOMWindow&WorkerGlobalScope, ActiveDOMObject, Constructor, ConstructorCallWith=ScriptExecutionContext, + ExportMacro=WEBCORE_EXPORT, + Exposed=(Window,Worker), JSCustomMarkFunction, - EventTarget, - JSNoStaticTables, -] interface XMLHttpRequest { - // From XMLHttpRequestEventTarget - // event handler attributes - attribute EventListener onabort; - attribute EventListener onerror; - attribute EventListener onload; - attribute EventListener onloadend; - attribute EventListener onloadstart; - attribute EventListener onprogress; - [Conditional=XHR_TIMEOUT] attribute EventListener ontimeout; - - // event handler attributes - attribute EventListener onreadystatechange; + JSGenerateToJSObject, + JSGenerateToNativeObject, + PrivateIdentifier, + PublicIdentifier, +] interface XMLHttpRequest : XMLHttpRequestEventTarget { + // event handler + attribute EventHandler onreadystatechange; // state const unsigned short UNSENT = 0; @@ -63,43 +60,33 @@ enum XMLHttpRequestResponseType { const unsigned short HEADERS_RECEIVED = 2; const unsigned short LOADING = 3; const unsigned short DONE = 4; - - [Conditional=XHR_TIMEOUT, SetterRaisesException] attribute unsigned long timeout; readonly attribute unsigned short readyState; - [SetterRaisesException] 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(); - - void abort(); - + // request + [MayThrowException] void open(ByteString method, DOMString url); // FIXME: url should be a USVString. + [MayThrowException] void open(ByteString method, DOMString url, boolean async, optional DOMString? user = null, optional DOMString? password = null); // FIXME: url/user/password should all be a USVStrings. + [MayThrowException] void setRequestHeader(ByteString header, ByteString value); + [SetterMayThrowException] attribute unsigned long timeout; + [SetterMayThrowException] attribute boolean withCredentials; readonly attribute XMLHttpRequestUpload upload; + [CallWith=ScriptState, MayThrowException] void send(optional (Document or BodyInit)? body = null); + void abort(); // response - [TreatReturnedNullStringAs=Undefined] DOMString getAllResponseHeaders(); - [TreatReturnedNullStringAs=Null] DOMString getResponseHeader(DOMString header); - [GetterRaisesException, CustomGetter] readonly attribute DOMString responseText; // The custom getter implements TreatReturnedNullStringAs=Null - [GetterRaisesException] readonly attribute Document responseXML; - - [SetterRaisesException] attribute XMLHttpRequestResponseType responseType; - [GetterRaisesException, CachedAttribute, CustomGetter] readonly attribute Object response; - - [GetterRaisesException] readonly attribute unsigned short status; - [GetterRaisesException] readonly attribute DOMString statusText; - - // Extension - void overrideMimeType(DOMString override); + readonly attribute USVString responseURL; + readonly attribute unsigned short status; + readonly attribute ByteString statusText; + ByteString? getResponseHeader(ByteString name); + ByteString getAllResponseHeaders(); + [MayThrowException] void overrideMimeType(DOMString mime); + [SetterMayThrowException] attribute XMLHttpRequestResponseType responseType; + [JSBuiltin] readonly attribute any response; + [GetterMayThrowException, CustomGetter] readonly attribute USVString? responseText; + // FIXME: responseXML should be annotated with [Exposed=Window]. + [GetterMayThrowException] readonly attribute Document? responseXML; + + // internals + [PrivateIdentifier] boolean responseCacheIsValid(); + [PrivateIdentifier, Custom] any retrieveResponse(); - // EventTarget interface - void addEventListener(DOMString type, - EventListener listener, - optional boolean useCapture); - void removeEventListener(DOMString type, - EventListener listener, - optional boolean useCapture); - [RaisesException] boolean dispatchEvent(Event evt); }; |