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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 enum ResponseTypeCode { | 65 enum ResponseTypeCode { |
66 ResponseTypeDefault, | 66 ResponseTypeDefault, |
67 ResponseTypeText, | 67 ResponseTypeText, |
68 ResponseTypeDocument, | 68 ResponseTypeDocument, |
69 ResponseTypeBlob, | 69 ResponseTypeBlob, |
70 ResponseTypeArrayBuffer | 70 ResponseTypeArrayBuffer |
71 }; | 71 }; |
72 | 72 |
73 virtual void contextDestroyed(); | 73 virtual void contextDestroyed(); |
74 #if ENABLE(XHR_TIMEOUT) | |
75 virtual void didTimeout(); | 74 virtual void didTimeout(); |
76 #endif | |
77 virtual bool canSuspend() const; | 75 virtual bool canSuspend() const; |
78 virtual void suspend(ReasonForSuspension); | 76 virtual void suspend(ReasonForSuspension); |
79 virtual void resume(); | 77 virtual void resume(); |
80 virtual void stop(); | 78 virtual void stop(); |
81 | 79 |
82 virtual const AtomicString& interfaceName() const; | 80 virtual const AtomicString& interfaceName() const; |
83 virtual ScriptExecutionContext* scriptExecutionContext() const; | 81 virtual ScriptExecutionContext* scriptExecutionContext() const; |
84 | 82 |
85 const KURL& url() const { return m_url; } | 83 const KURL& url() const { return m_url; } |
86 String statusText(ExceptionCode&) const; | 84 String statusText(ExceptionCode&) const; |
(...skipping 15 matching lines...) Expand all Loading... |
102 void abort(); | 100 void abort(); |
103 void setRequestHeader(const AtomicString& name, const String& value, Excepti
onCode&); | 101 void setRequestHeader(const AtomicString& name, const String& value, Excepti
onCode&); |
104 void overrideMimeType(const String& override); | 102 void overrideMimeType(const String& override); |
105 String getAllResponseHeaders(ExceptionCode&) const; | 103 String getAllResponseHeaders(ExceptionCode&) const; |
106 String getResponseHeader(const AtomicString& name, ExceptionCode&) const; | 104 String getResponseHeader(const AtomicString& name, ExceptionCode&) const; |
107 String responseText(ExceptionCode&); | 105 String responseText(ExceptionCode&); |
108 Document* responseXML(ExceptionCode&); | 106 Document* responseXML(ExceptionCode&); |
109 Document* optionalResponseXML() const { return m_responseDocument.get(); } | 107 Document* optionalResponseXML() const { return m_responseDocument.get(); } |
110 Blob* responseBlob(ExceptionCode&); | 108 Blob* responseBlob(ExceptionCode&); |
111 Blob* optionalResponseBlob() const { return m_responseBlob.get(); } | 109 Blob* optionalResponseBlob() const { return m_responseBlob.get(); } |
112 #if ENABLE(XHR_TIMEOUT) | |
113 unsigned long timeout() const { return m_timeoutMilliseconds; } | 110 unsigned long timeout() const { return m_timeoutMilliseconds; } |
114 void setTimeout(unsigned long timeout, ExceptionCode&); | 111 void setTimeout(unsigned long timeout, ExceptionCode&); |
115 #endif | |
116 | 112 |
117 void sendFromInspector(PassRefPtr<FormData>, ExceptionCode&); | 113 void sendFromInspector(PassRefPtr<FormData>, ExceptionCode&); |
118 | 114 |
119 // Expose HTTP validation methods for other untrusted requests. | 115 // Expose HTTP validation methods for other untrusted requests. |
120 static bool isAllowedHTTPMethod(const String&); | 116 static bool isAllowedHTTPMethod(const String&); |
121 static String uppercaseKnownHTTPMethod(const String&); | 117 static String uppercaseKnownHTTPMethod(const String&); |
122 static bool isAllowedHTTPHeader(const String&); | 118 static bool isAllowedHTTPHeader(const String&); |
123 | 119 |
124 void setResponseType(const String&, ExceptionCode&); | 120 void setResponseType(const String&, ExceptionCode&); |
125 String responseType(); | 121 String responseType(); |
(...skipping 11 matching lines...) Expand all Loading... |
137 | 133 |
138 virtual void reportMemoryUsage(MemoryObjectInfo*) const; | 134 virtual void reportMemoryUsage(MemoryObjectInfo*) const; |
139 | 135 |
140 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); | 136 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); |
141 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 137 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
142 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 138 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
143 DEFINE_ATTRIBUTE_EVENT_LISTENER(load); | 139 DEFINE_ATTRIBUTE_EVENT_LISTENER(load); |
144 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend); | 140 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend); |
145 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); | 141 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); |
146 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); | 142 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); |
147 #if ENABLE(XHR_TIMEOUT) | |
148 DEFINE_ATTRIBUTE_EVENT_LISTENER(timeout); | 143 DEFINE_ATTRIBUTE_EVENT_LISTENER(timeout); |
149 #endif | |
150 | 144 |
151 using RefCounted<XMLHttpRequest>::ref; | 145 using RefCounted<XMLHttpRequest>::ref; |
152 using RefCounted<XMLHttpRequest>::deref; | 146 using RefCounted<XMLHttpRequest>::deref; |
153 | 147 |
154 private: | 148 private: |
155 XMLHttpRequest(ScriptExecutionContext*, PassRefPtr<SecurityOrigin>); | 149 XMLHttpRequest(ScriptExecutionContext*, PassRefPtr<SecurityOrigin>); |
156 | 150 |
157 virtual void refEventTarget() { ref(); } | 151 virtual void refEventTarget() { ref(); } |
158 virtual void derefEventTarget() { deref(); } | 152 virtual void derefEventTarget() { deref(); } |
159 virtual EventTargetData* eventTargetData(); | 153 virtual EventTargetData* eventTargetData(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 188 |
195 OwnPtr<XMLHttpRequestUpload> m_upload; | 189 OwnPtr<XMLHttpRequestUpload> m_upload; |
196 | 190 |
197 KURL m_url; | 191 KURL m_url; |
198 String m_method; | 192 String m_method; |
199 HTTPHeaderMap m_requestHeaders; | 193 HTTPHeaderMap m_requestHeaders; |
200 RefPtr<FormData> m_requestEntityBody; | 194 RefPtr<FormData> m_requestEntityBody; |
201 String m_mimeTypeOverride; | 195 String m_mimeTypeOverride; |
202 bool m_async; | 196 bool m_async; |
203 bool m_includeCredentials; | 197 bool m_includeCredentials; |
204 #if ENABLE(XHR_TIMEOUT) | |
205 unsigned long m_timeoutMilliseconds; | 198 unsigned long m_timeoutMilliseconds; |
206 #endif | |
207 RefPtr<Blob> m_responseBlob; | 199 RefPtr<Blob> m_responseBlob; |
208 | 200 |
209 RefPtr<ThreadableLoader> m_loader; | 201 RefPtr<ThreadableLoader> m_loader; |
210 State m_state; | 202 State m_state; |
211 | 203 |
212 ResourceResponse m_response; | 204 ResourceResponse m_response; |
213 String m_responseEncoding; | 205 String m_responseEncoding; |
214 | 206 |
215 RefPtr<TextResourceDecoder> m_decoder; | 207 RefPtr<TextResourceDecoder> m_decoder; |
216 | 208 |
(...skipping 24 matching lines...) Expand all Loading... |
241 | 233 |
242 // An enum corresponding to the allowed string values for the responseType a
ttribute. | 234 // An enum corresponding to the allowed string values for the responseType a
ttribute. |
243 ResponseTypeCode m_responseTypeCode; | 235 ResponseTypeCode m_responseTypeCode; |
244 | 236 |
245 RefPtr<SecurityOrigin> m_securityOrigin; | 237 RefPtr<SecurityOrigin> m_securityOrigin; |
246 }; | 238 }; |
247 | 239 |
248 } // namespace WebCore | 240 } // namespace WebCore |
249 | 241 |
250 #endif // XMLHttpRequest_h | 242 #endif // XMLHttpRequest_h |
OLD | NEW |