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. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Lesser General Public License for more details. | 15 * Lesser General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Lesser General Public | 17 * You should have received a copy of the GNU Lesser General Public |
18 * License along with this library; if not, write to the Free Software | 18 * License along with this library; if not, write to the Free Software |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA |
20 */ | 20 */ |
21 | 21 |
22 #ifndef XMLHttpRequest_h | 22 #ifndef XMLHttpRequest_h |
23 #define XMLHttpRequest_h | 23 #define XMLHttpRequest_h |
24 | 24 |
25 #include "bindings/core/v8/ScriptString.h" | 25 #include "bindings/core/v8/ScriptString.h" |
26 #include "core/dom/ActiveDOMObject.h" | 26 #include "core/dom/ActiveDOMObject.h" |
27 #include "core/events/EventListener.h" | 27 #include "core/events/EventListener.h" |
28 #include "core/loader/ThreadableLoaderClient.h" | 28 #include "core/loader/ThreadableLoaderClient.h" |
| 29 #include "core/streams/ReadableStreamImpl.h" |
29 #include "core/xml/XMLHttpRequestEventTarget.h" | 30 #include "core/xml/XMLHttpRequestEventTarget.h" |
30 #include "core/xml/XMLHttpRequestProgressEventThrottle.h" | 31 #include "core/xml/XMLHttpRequestProgressEventThrottle.h" |
31 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
32 #include "platform/network/FormData.h" | 33 #include "platform/network/FormData.h" |
33 #include "platform/network/ResourceResponse.h" | 34 #include "platform/network/ResourceResponse.h" |
34 #include "platform/weborigin/SecurityOrigin.h" | 35 #include "platform/weborigin/SecurityOrigin.h" |
35 #include "wtf/OwnPtr.h" | 36 #include "wtf/OwnPtr.h" |
36 #include "wtf/text/AtomicStringHash.h" | 37 #include "wtf/text/AtomicStringHash.h" |
37 #include "wtf/text/StringBuilder.h" | 38 #include "wtf/text/StringBuilder.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 class Blob; | 42 class Blob; |
42 class DOMFormData; | 43 class DOMFormData; |
43 class Document; | 44 class Document; |
44 class ExceptionState; | 45 class ExceptionState; |
45 class ResourceRequest; | 46 class ResourceRequest; |
46 class SecurityOrigin; | 47 class SecurityOrigin; |
47 class SharedBuffer; | 48 class SharedBuffer; |
48 class Stream; | 49 class Stream; |
49 class TextResourceDecoder; | 50 class TextResourceDecoder; |
50 class ThreadableLoader; | 51 class ThreadableLoader; |
| 52 class UnderlyingSource; |
51 | 53 |
52 typedef int ExceptionCode; | 54 typedef int ExceptionCode; |
53 | 55 |
54 class XMLHttpRequest FINAL | 56 class XMLHttpRequest FINAL |
55 : public RefCountedWillBeRefCountedGarbageCollected<XMLHttpRequest> | 57 : public RefCountedWillBeRefCountedGarbageCollected<XMLHttpRequest> |
56 , public XMLHttpRequestEventTarget | 58 , public XMLHttpRequestEventTarget |
57 , private ThreadableLoaderClient | 59 , private ThreadableLoaderClient |
58 , public ActiveDOMObject { | 60 , public ActiveDOMObject { |
59 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 61 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
60 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); | 62 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); |
(...skipping 11 matching lines...) Expand all Loading... |
72 DONE = 4 | 74 DONE = 4 |
73 }; | 75 }; |
74 | 76 |
75 enum ResponseTypeCode { | 77 enum ResponseTypeCode { |
76 ResponseTypeDefault, | 78 ResponseTypeDefault, |
77 ResponseTypeText, | 79 ResponseTypeText, |
78 ResponseTypeJSON, | 80 ResponseTypeJSON, |
79 ResponseTypeDocument, | 81 ResponseTypeDocument, |
80 ResponseTypeBlob, | 82 ResponseTypeBlob, |
81 ResponseTypeArrayBuffer, | 83 ResponseTypeArrayBuffer, |
82 ResponseTypeLegacyStream | 84 ResponseTypeLegacyStream, |
| 85 ResponseTypeStream, |
83 }; | 86 }; |
84 | 87 |
85 virtual void contextDestroyed() OVERRIDE; | 88 virtual void contextDestroyed() OVERRIDE; |
86 virtual void suspend() OVERRIDE; | 89 virtual void suspend() OVERRIDE; |
87 virtual void resume() OVERRIDE; | 90 virtual void resume() OVERRIDE; |
88 virtual void stop() OVERRIDE; | 91 virtual void stop() OVERRIDE; |
89 virtual bool hasPendingActivity() const OVERRIDE; | 92 virtual bool hasPendingActivity() const OVERRIDE; |
90 | 93 |
91 virtual const AtomicString& interfaceName() const OVERRIDE; | 94 virtual const AtomicString& interfaceName() const OVERRIDE; |
92 virtual ExecutionContext* executionContext() const OVERRIDE; | 95 virtual ExecutionContext* executionContext() const OVERRIDE; |
(...skipping 17 matching lines...) Expand all Loading... |
110 void send(ArrayBufferView*, ExceptionState&); | 113 void send(ArrayBufferView*, ExceptionState&); |
111 void abort(); | 114 void abort(); |
112 void setRequestHeader(const AtomicString& name, const AtomicString& value, E
xceptionState&); | 115 void setRequestHeader(const AtomicString& name, const AtomicString& value, E
xceptionState&); |
113 void overrideMimeType(const AtomicString& override); | 116 void overrideMimeType(const AtomicString& override); |
114 String getAllResponseHeaders() const; | 117 String getAllResponseHeaders() const; |
115 const AtomicString& getResponseHeader(const AtomicString&) const; | 118 const AtomicString& getResponseHeader(const AtomicString&) const; |
116 ScriptString responseText(ExceptionState&); | 119 ScriptString responseText(ExceptionState&); |
117 ScriptString responseJSONSource(); | 120 ScriptString responseJSONSource(); |
118 Document* responseXML(ExceptionState&); | 121 Document* responseXML(ExceptionState&); |
119 Blob* responseBlob(); | 122 Blob* responseBlob(); |
120 Stream* responseStream(); | 123 Stream* responseLegacyStream(); |
| 124 ReadableStream* responseStream(); |
121 unsigned long timeout() const { return m_timeoutMilliseconds; } | 125 unsigned long timeout() const { return m_timeoutMilliseconds; } |
122 void setTimeout(unsigned long timeout, ExceptionState&); | 126 void setTimeout(unsigned long timeout, ExceptionState&); |
123 | 127 |
124 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&); | 128 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&); |
125 | 129 |
126 // Expose HTTP validation methods for other untrusted requests. | 130 // Expose HTTP validation methods for other untrusted requests. |
127 static AtomicString uppercaseKnownHTTPMethod(const AtomicString&); | 131 static AtomicString uppercaseKnownHTTPMethod(const AtomicString&); |
128 | 132 |
129 void setResponseType(const String&, ExceptionState&); | 133 void setResponseType(const String&, ExceptionState&); |
130 String responseType(); | 134 String responseType(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 OwnPtrWillBeMember<XMLHttpRequestUpload> m_upload; | 227 OwnPtrWillBeMember<XMLHttpRequestUpload> m_upload; |
224 | 228 |
225 KURL m_url; | 229 KURL m_url; |
226 AtomicString m_method; | 230 AtomicString m_method; |
227 HTTPHeaderMap m_requestHeaders; | 231 HTTPHeaderMap m_requestHeaders; |
228 // Not converted to ASCII lowercase. Must be lowered later or compared | 232 // Not converted to ASCII lowercase. Must be lowered later or compared |
229 // using case insensitive comparison functions if needed. | 233 // using case insensitive comparison functions if needed. |
230 AtomicString m_mimeTypeOverride; | 234 AtomicString m_mimeTypeOverride; |
231 unsigned long m_timeoutMilliseconds; | 235 unsigned long m_timeoutMilliseconds; |
232 RefPtrWillBeMember<Blob> m_responseBlob; | 236 RefPtrWillBeMember<Blob> m_responseBlob; |
233 RefPtrWillBeMember<Stream> m_responseStream; | 237 RefPtrWillBeMember<Stream> m_responseLegacyStream; |
| 238 PersistentWillBeMember<ReadableStreamImpl<ReadableStreamChunkTypeTraits<Arra
yBuffer> > > m_responseStream; |
| 239 PersistentWillBeMember<UnderlyingSource> m_streamSource; |
234 | 240 |
235 RefPtr<ThreadableLoader> m_loader; | 241 RefPtr<ThreadableLoader> m_loader; |
236 State m_state; | 242 State m_state; |
237 | 243 |
238 ResourceResponse m_response; | 244 ResourceResponse m_response; |
239 String m_finalResponseCharset; | 245 String m_finalResponseCharset; |
240 | 246 |
241 OwnPtr<TextResourceDecoder> m_decoder; | 247 OwnPtr<TextResourceDecoder> m_decoder; |
242 | 248 |
243 ScriptString m_responseText; | 249 ScriptString m_responseText; |
(...skipping 29 matching lines...) Expand all Loading... |
273 bool m_parsedResponse; | 279 bool m_parsedResponse; |
274 bool m_error; | 280 bool m_error; |
275 bool m_uploadEventsAllowed; | 281 bool m_uploadEventsAllowed; |
276 bool m_uploadComplete; | 282 bool m_uploadComplete; |
277 bool m_sameOriginRequest; | 283 bool m_sameOriginRequest; |
278 }; | 284 }; |
279 | 285 |
280 } // namespace blink | 286 } // namespace blink |
281 | 287 |
282 #endif // XMLHttpRequest_h | 288 #endif // XMLHttpRequest_h |
OLD | NEW |