| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> | 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> |
| 4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2012 Intel Corporation | 5 * Copyright (C) 2012 Intel Corporation |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #define XMLHttpRequest_h | 23 #define XMLHttpRequest_h |
| 24 | 24 |
| 25 #include "bindings/v8/ScriptString.h" | 25 #include "bindings/v8/ScriptString.h" |
| 26 #include "bindings/v8/ScriptWrappable.h" | 26 #include "bindings/v8/ScriptWrappable.h" |
| 27 #include "core/dom/ActiveDOMObject.h" | 27 #include "core/dom/ActiveDOMObject.h" |
| 28 #include "core/events/EventListener.h" | 28 #include "core/events/EventListener.h" |
| 29 #include "core/events/ThreadLocalEventNames.h" | 29 #include "core/events/ThreadLocalEventNames.h" |
| 30 #include "core/loader/ThreadableLoaderClient.h" | 30 #include "core/loader/ThreadableLoaderClient.h" |
| 31 #include "core/xml/XMLHttpRequestEventTarget.h" | 31 #include "core/xml/XMLHttpRequestEventTarget.h" |
| 32 #include "core/xml/XMLHttpRequestProgressEventThrottle.h" | 32 #include "core/xml/XMLHttpRequestProgressEventThrottle.h" |
| 33 #include "platform/AsyncMethodRunner.h" | |
| 34 #include "platform/network/FormData.h" | 33 #include "platform/network/FormData.h" |
| 35 #include "platform/network/ResourceResponse.h" | 34 #include "platform/network/ResourceResponse.h" |
| 36 #include "platform/weborigin/SecurityOrigin.h" | 35 #include "platform/weborigin/SecurityOrigin.h" |
| 37 #include "wtf/OwnPtr.h" | 36 #include "wtf/OwnPtr.h" |
| 38 #include "wtf/text/AtomicStringHash.h" | 37 #include "wtf/text/AtomicStringHash.h" |
| 39 #include "wtf/text/StringBuilder.h" | 38 #include "wtf/text/StringBuilder.h" |
| 40 | 39 |
| 41 namespace WebCore { | 40 namespace WebCore { |
| 42 | 41 |
| 43 class Blob; | 42 class Blob; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 72 enum ResponseTypeCode { | 71 enum ResponseTypeCode { |
| 73 ResponseTypeDefault, | 72 ResponseTypeDefault, |
| 74 ResponseTypeText, | 73 ResponseTypeText, |
| 75 ResponseTypeJSON, | 74 ResponseTypeJSON, |
| 76 ResponseTypeDocument, | 75 ResponseTypeDocument, |
| 77 ResponseTypeBlob, | 76 ResponseTypeBlob, |
| 78 ResponseTypeArrayBuffer, | 77 ResponseTypeArrayBuffer, |
| 79 ResponseTypeStream | 78 ResponseTypeStream |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 enum DropProtection { | 81 // ActiveDOMObject implementaions |
| 83 DropProtectionSync, | 82 virtual void contextDestroyed() OVERRIDE; |
| 84 DropProtectionAsync, | 83 // Keep the JavaScript wrapper alive while a request is in progress so that |
| 85 }; | 84 // this object (which is a listener for m_loader) is also kept alive. |
| 86 | 85 virtual bool hasPendingActivity() const OVERRIDE; |
| 87 virtual void contextDestroyed(); | 86 virtual void suspend() OVERRIDE; |
| 88 virtual void suspend(); | 87 virtual void resume() OVERRIDE; |
| 89 virtual void resume(); | 88 virtual void stop() OVERRIDE; |
| 90 virtual void stop(); | |
| 91 | 89 |
| 92 virtual const AtomicString& interfaceName() const OVERRIDE; | 90 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 93 virtual ExecutionContext* executionContext() const OVERRIDE; | 91 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 94 | 92 |
| 95 const KURL& url() const { return m_url; } | 93 const KURL& url() const { return m_url; } |
| 96 String statusText(ExceptionState&) const; | 94 String statusText(ExceptionState&) const; |
| 97 int status(ExceptionState&) const; | 95 int status(ExceptionState&) const; |
| 98 State readyState() const; | 96 State readyState() const; |
| 99 bool withCredentials() const { return m_includeCredentials; } | 97 bool withCredentials() const { return m_includeCredentials; } |
| 100 void setWithCredentials(bool, ExceptionState&); | 98 void setWithCredentials(bool, ExceptionState&); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void sendBytesData(const void*, size_t, ExceptionState&); | 163 void sendBytesData(const void*, size_t, ExceptionState&); |
| 166 | 164 |
| 167 AtomicString getRequestHeader(const AtomicString& name) const; | 165 AtomicString getRequestHeader(const AtomicString& name) const; |
| 168 void setRequestHeaderInternal(const AtomicString& name, const AtomicString&
value); | 166 void setRequestHeaderInternal(const AtomicString& name, const AtomicString&
value); |
| 169 | 167 |
| 170 // Changes m_state and dispatches a readyStateChange event if new m_state | 168 // Changes m_state and dispatches a readyStateChange event if new m_state |
| 171 // value is different from last one. | 169 // value is different from last one. |
| 172 void changeState(State newState); | 170 void changeState(State newState); |
| 173 void dispatchReadyStateChangeEvent(); | 171 void dispatchReadyStateChangeEvent(); |
| 174 | 172 |
| 175 void dropProtectionSoon(); | |
| 176 void dropProtection(); | |
| 177 // Clears variables used only while the resource is being loaded. | 173 // Clears variables used only while the resource is being loaded. |
| 178 void clearVariablesForLoading(); | 174 void clearVariablesForLoading(); |
| 179 // Returns false iff reentry happened and a new load is started. | 175 // Returns false iff reentry happened and a new load is started. |
| 180 bool internalAbort(DropProtection = DropProtectionSync); | 176 bool internalAbort(); |
| 181 // Clears variables holding response header and body data. | 177 // Clears variables holding response header and body data. |
| 182 void clearResponse(); | 178 void clearResponse(); |
| 183 void clearRequest(); | 179 void clearRequest(); |
| 184 | 180 |
| 185 void createRequest(ExceptionState&); | 181 void createRequest(ExceptionState&); |
| 186 | 182 |
| 187 // Dispatches an event of the specified type to m_progressEventThrottle. | 183 // Dispatches an event of the specified type to m_progressEventThrottle. |
| 188 void dispatchEventAndLoadEnd(const AtomicString&, long long, long long); | 184 void dispatchEventAndLoadEnd(const AtomicString&, long long, long long); |
| 189 | 185 |
| 190 // Dispatches a response progress event to m_progressEventThrottle. | 186 // Dispatches a response progress event to m_progressEventThrottle. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 String m_lastSendURL; | 245 String m_lastSendURL; |
| 250 // An exception to throw in synchronous mode. It's set when failure | 246 // An exception to throw in synchronous mode. It's set when failure |
| 251 // notification is received from m_loader and thrown at the end of send() if | 247 // notification is received from m_loader and thrown at the end of send() if |
| 252 // any. | 248 // any. |
| 253 ExceptionCode m_exceptionCode; | 249 ExceptionCode m_exceptionCode; |
| 254 | 250 |
| 255 XMLHttpRequestProgressEventThrottle m_progressEventThrottle; | 251 XMLHttpRequestProgressEventThrottle m_progressEventThrottle; |
| 256 | 252 |
| 257 // An enum corresponding to the allowed string values for the responseType a
ttribute. | 253 // An enum corresponding to the allowed string values for the responseType a
ttribute. |
| 258 ResponseTypeCode m_responseTypeCode; | 254 ResponseTypeCode m_responseTypeCode; |
| 259 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; | |
| 260 RefPtr<SecurityOrigin> m_securityOrigin; | 255 RefPtr<SecurityOrigin> m_securityOrigin; |
| 261 }; | 256 }; |
| 262 | 257 |
| 263 } // namespace WebCore | 258 } // namespace WebCore |
| 264 | 259 |
| 265 #endif // XMLHttpRequest_h | 260 #endif // XMLHttpRequest_h |
| OLD | NEW |