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/dom/DocumentParserClient.h" |
27 #include "core/events/EventListener.h" | 28 #include "core/events/EventListener.h" |
28 #include "core/loader/ThreadableLoaderClient.h" | 29 #include "core/loader/ThreadableLoaderClient.h" |
29 #include "core/streams/ReadableStreamImpl.h" | 30 #include "core/streams/ReadableStreamImpl.h" |
30 #include "core/xml/XMLHttpRequestEventTarget.h" | 31 #include "core/xml/XMLHttpRequestEventTarget.h" |
31 #include "core/xml/XMLHttpRequestProgressEventThrottle.h" | 32 #include "core/xml/XMLHttpRequestProgressEventThrottle.h" |
32 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
33 #include "platform/network/FormData.h" | 34 #include "platform/network/FormData.h" |
34 #include "platform/network/ResourceResponse.h" | 35 #include "platform/network/ResourceResponse.h" |
35 #include "platform/weborigin/SecurityOrigin.h" | 36 #include "platform/weborigin/SecurityOrigin.h" |
36 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
(...skipping 14 matching lines...) Expand all Loading... |
51 class TextResourceDecoder; | 52 class TextResourceDecoder; |
52 class ThreadableLoader; | 53 class ThreadableLoader; |
53 class UnderlyingSource; | 54 class UnderlyingSource; |
54 | 55 |
55 typedef int ExceptionCode; | 56 typedef int ExceptionCode; |
56 | 57 |
57 class XMLHttpRequest FINAL | 58 class XMLHttpRequest FINAL |
58 : public RefCountedWillBeGarbageCollectedFinalized<XMLHttpRequest> | 59 : public RefCountedWillBeGarbageCollectedFinalized<XMLHttpRequest> |
59 , public XMLHttpRequestEventTarget | 60 , public XMLHttpRequestEventTarget |
60 , private ThreadableLoaderClient | 61 , private ThreadableLoaderClient |
| 62 , public DocumentParserClient |
61 , public ActiveDOMObject { | 63 , public ActiveDOMObject { |
62 DEFINE_WRAPPERTYPEINFO(); | 64 DEFINE_WRAPPERTYPEINFO(); |
63 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); | 65 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); |
64 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest); | 66 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest); |
65 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 67 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
66 public: | 68 public: |
67 static PassRefPtrWillBeRawPtr<XMLHttpRequest> create(ExecutionContext*, Pass
RefPtr<SecurityOrigin> = nullptr); | 69 static PassRefPtrWillBeRawPtr<XMLHttpRequest> create(ExecutionContext*, Pass
RefPtr<SecurityOrigin> = nullptr); |
68 virtual ~XMLHttpRequest(); | 70 virtual ~XMLHttpRequest(); |
69 | 71 |
70 // These exact numeric values are important because JS expects them. | 72 // These exact numeric values are important because JS expects them. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) OVERRIDE; | 161 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) OVERRIDE; |
160 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&) OVERRIDE; | 162 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&) OVERRIDE; |
161 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; | 163 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; |
162 // When responseType is set to "blob", didDownloadData() is called instead | 164 // When responseType is set to "blob", didDownloadData() is called instead |
163 // of didReceiveData(). | 165 // of didReceiveData(). |
164 virtual void didDownloadData(int dataLength) OVERRIDE; | 166 virtual void didDownloadData(int dataLength) OVERRIDE; |
165 virtual void didFinishLoading(unsigned long identifier, double finishTime) O
VERRIDE; | 167 virtual void didFinishLoading(unsigned long identifier, double finishTime) O
VERRIDE; |
166 virtual void didFail(const ResourceError&) OVERRIDE; | 168 virtual void didFail(const ResourceError&) OVERRIDE; |
167 virtual void didFailRedirectCheck() OVERRIDE; | 169 virtual void didFailRedirectCheck() OVERRIDE; |
168 | 170 |
| 171 // DocumentParserClient |
| 172 virtual void notifyParserStopped() OVERRIDE; |
| 173 |
| 174 void endLoading(); |
| 175 |
169 // Returns the MIME type part of m_mimeTypeOverride if present and | 176 // Returns the MIME type part of m_mimeTypeOverride if present and |
170 // successfully parsed, or returns one of the "Content-Type" header value | 177 // successfully parsed, or returns one of the "Content-Type" header value |
171 // of the received response. | 178 // of the received response. |
172 // | 179 // |
173 // This method is named after the term "final MIME type" defined in the | 180 // This method is named after the term "final MIME type" defined in the |
174 // spec but doesn't convert the result to ASCII lowercase as specified in | 181 // spec but doesn't convert the result to ASCII lowercase as specified in |
175 // the spec. Must be lowered later or compared using case insensitive | 182 // the spec. Must be lowered later or compared using case insensitive |
176 // comparison functions if required. | 183 // comparison functions if required. |
177 AtomicString finalResponseMIMEType() const; | 184 AtomicString finalResponseMIMEType() const; |
178 // The same as finalResponseMIMEType() but fallbacks to "text/xml" if | 185 // The same as finalResponseMIMEType() but fallbacks to "text/xml" if |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // Not converted to ASCII lowercase. Must be lowered later or compared | 244 // Not converted to ASCII lowercase. Must be lowered later or compared |
238 // using case insensitive comparison functions if needed. | 245 // using case insensitive comparison functions if needed. |
239 AtomicString m_mimeTypeOverride; | 246 AtomicString m_mimeTypeOverride; |
240 unsigned long m_timeoutMilliseconds; | 247 unsigned long m_timeoutMilliseconds; |
241 RefPtrWillBeMember<Blob> m_responseBlob; | 248 RefPtrWillBeMember<Blob> m_responseBlob; |
242 RefPtrWillBeMember<Stream> m_responseLegacyStream; | 249 RefPtrWillBeMember<Stream> m_responseLegacyStream; |
243 PersistentWillBeMember<ReadableStreamImpl<ReadableStreamChunkTypeTraits<Arra
yBuffer> > > m_responseStream; | 250 PersistentWillBeMember<ReadableStreamImpl<ReadableStreamChunkTypeTraits<Arra
yBuffer> > > m_responseStream; |
244 PersistentWillBeMember<UnderlyingSource> m_streamSource; | 251 PersistentWillBeMember<UnderlyingSource> m_streamSource; |
245 | 252 |
246 RefPtr<ThreadableLoader> m_loader; | 253 RefPtr<ThreadableLoader> m_loader; |
| 254 unsigned long m_loaderIdentifier; |
247 State m_state; | 255 State m_state; |
248 | 256 |
249 ResourceResponse m_response; | 257 ResourceResponse m_response; |
250 String m_finalResponseCharset; | 258 String m_finalResponseCharset; |
251 | 259 |
252 OwnPtr<TextResourceDecoder> m_decoder; | 260 OwnPtr<TextResourceDecoder> m_decoder; |
253 | 261 |
254 ScriptString m_responseText; | 262 ScriptString m_responseText; |
255 RefPtrWillBeMember<Document> m_responseDocument; | 263 RefPtrWillBeMember<Document> m_responseDocument; |
256 RefPtrWillBeMember<DocumentParser> m_responseDocumentParser; | 264 RefPtrWillBeMember<DocumentParser> m_responseDocumentParser; |
(...skipping 26 matching lines...) Expand all Loading... |
283 bool m_parsedResponse; | 291 bool m_parsedResponse; |
284 bool m_error; | 292 bool m_error; |
285 bool m_uploadEventsAllowed; | 293 bool m_uploadEventsAllowed; |
286 bool m_uploadComplete; | 294 bool m_uploadComplete; |
287 bool m_sameOriginRequest; | 295 bool m_sameOriginRequest; |
288 }; | 296 }; |
289 | 297 |
290 } // namespace blink | 298 } // namespace blink |
291 | 299 |
292 #endif // XMLHttpRequest_h | 300 #endif // XMLHttpRequest_h |
OLD | NEW |