| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 , private ThreadableLoaderClient | 72 , private ThreadableLoaderClient |
| 73 , public DocumentParserClient | 73 , public DocumentParserClient |
| 74 , public ActiveDOMObject { | 74 , public ActiveDOMObject { |
| 75 DEFINE_WRAPPERTYPEINFO(); | 75 DEFINE_WRAPPERTYPEINFO(); |
| 76 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); | 76 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); |
| 77 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(XMLHttpRequest); | 77 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(XMLHttpRequest); |
| 78 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest); | 78 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest); |
| 79 public: | 79 public: |
| 80 static PassRefPtrWillBeRawPtr<XMLHttpRequest> create(ScriptState*); | 80 static PassRefPtrWillBeRawPtr<XMLHttpRequest> create(ScriptState*); |
| 81 static PassRefPtrWillBeRawPtr<XMLHttpRequest> create(ExecutionContext*); | 81 static PassRefPtrWillBeRawPtr<XMLHttpRequest> create(ExecutionContext*); |
| 82 virtual ~XMLHttpRequest(); | 82 ~XMLHttpRequest() override; |
| 83 | 83 |
| 84 // These exact numeric values are important because JS expects them. | 84 // These exact numeric values are important because JS expects them. |
| 85 enum State { | 85 enum State { |
| 86 UNSENT = 0, | 86 UNSENT = 0, |
| 87 OPENED = 1, | 87 OPENED = 1, |
| 88 HEADERS_RECEIVED = 2, | 88 HEADERS_RECEIVED = 2, |
| 89 LOADING = 3, | 89 LOADING = 3, |
| 90 DONE = 4 | 90 DONE = 4 |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 enum ResponseTypeCode { | 93 enum ResponseTypeCode { |
| 94 ResponseTypeDefault, | 94 ResponseTypeDefault, |
| 95 ResponseTypeText, | 95 ResponseTypeText, |
| 96 ResponseTypeJSON, | 96 ResponseTypeJSON, |
| 97 ResponseTypeDocument, | 97 ResponseTypeDocument, |
| 98 ResponseTypeBlob, | 98 ResponseTypeBlob, |
| 99 ResponseTypeArrayBuffer, | 99 ResponseTypeArrayBuffer, |
| 100 ResponseTypeLegacyStream, | 100 ResponseTypeLegacyStream, |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // ActiveDOMObject | 103 // ActiveDOMObject |
| 104 virtual void contextDestroyed() override; | 104 void contextDestroyed() override; |
| 105 virtual ExecutionContext* executionContext() const override; | 105 ExecutionContext* executionContext() const override; |
| 106 virtual bool hasPendingActivity() const override; | 106 bool hasPendingActivity() const override; |
| 107 virtual void suspend() override; | 107 void suspend() override; |
| 108 virtual void resume() override; | 108 void resume() override; |
| 109 virtual void stop() override; | 109 void stop() override; |
| 110 | 110 |
| 111 // XMLHttpRequestEventTarget | 111 // XMLHttpRequestEventTarget |
| 112 virtual const AtomicString& interfaceName() const override; | 112 const AtomicString& interfaceName() const override; |
| 113 | 113 |
| 114 // JavaScript attributes and methods | 114 // JavaScript attributes and methods |
| 115 const KURL& url() const { return m_url; } | 115 const KURL& url() const { return m_url; } |
| 116 String statusText() const; | 116 String statusText() const; |
| 117 int status() const; | 117 int status() const; |
| 118 State readyState() const; | 118 State readyState() const; |
| 119 bool withCredentials() const { return m_includeCredentials; } | 119 bool withCredentials() const { return m_includeCredentials; } |
| 120 void setWithCredentials(bool, ExceptionState&); | 120 void setWithCredentials(bool, ExceptionState&); |
| 121 void open(const AtomicString& method, const String& url, ExceptionState&); | 121 void open(const AtomicString& method, const String& url, ExceptionState&); |
| 122 void open(const AtomicString& method, const String& url, bool async, const S
tring& username, const String& password, ExceptionState&); | 122 void open(const AtomicString& method, const String& url, bool async, const S
tring& username, const String& password, ExceptionState&); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 149 | 149 |
| 150 DECLARE_VIRTUAL_TRACE(); | 150 DECLARE_VIRTUAL_TRACE(); |
| 151 | 151 |
| 152 private: | 152 private: |
| 153 class BlobLoader; | 153 class BlobLoader; |
| 154 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); | 154 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); |
| 155 | 155 |
| 156 Document* document() const; | 156 Document* document() const; |
| 157 SecurityOrigin* securityOrigin() const; | 157 SecurityOrigin* securityOrigin() const; |
| 158 | 158 |
| 159 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) override; | 159 void didSendData(unsigned long long bytesSent, unsigned long long totalBytes
ToBeSent) override; |
| 160 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&, PassOwnPtr<WebDataConsumerHandle>) override; | 160 void didReceiveResponse(unsigned long identifier, const ResourceResponse&, P
assOwnPtr<WebDataConsumerHandle>) override; |
| 161 virtual void didReceiveData(const char* data, unsigned dataLength) override; | 161 void didReceiveData(const char* data, unsigned dataLength) override; |
| 162 // When responseType is set to "blob", didDownloadData() is called instead | 162 // When responseType is set to "blob", didDownloadData() is called instead |
| 163 // of didReceiveData(). | 163 // of didReceiveData(). |
| 164 virtual void didDownloadData(int dataLength) override; | 164 void didDownloadData(int dataLength) override; |
| 165 virtual void didFinishLoading(unsigned long identifier, double finishTime) o
verride; | 165 void didFinishLoading(unsigned long identifier, double finishTime) override; |
| 166 virtual void didFail(const ResourceError&) override; | 166 void didFail(const ResourceError&) override; |
| 167 virtual void didFailRedirectCheck() override; | 167 void didFailRedirectCheck() override; |
| 168 | 168 |
| 169 // BlobLoader notifications. | 169 // BlobLoader notifications. |
| 170 void didFinishLoadingInternal(); | 170 void didFinishLoadingInternal(); |
| 171 void didFinishLoadingFromBlob(); | 171 void didFinishLoadingFromBlob(); |
| 172 void didFailLoadingFromBlob(); | 172 void didFailLoadingFromBlob(); |
| 173 | 173 |
| 174 PassRefPtr<BlobDataHandle> createBlobDataHandleFromResponse(); | 174 PassRefPtr<BlobDataHandle> createBlobDataHandleFromResponse(); |
| 175 | 175 |
| 176 // DocumentParserClient | 176 // DocumentParserClient |
| 177 virtual void notifyParserStopped() override; | 177 void notifyParserStopped() override; |
| 178 | 178 |
| 179 void endLoading(); | 179 void endLoading(); |
| 180 | 180 |
| 181 // Returns the MIME type part of m_mimeTypeOverride if present and | 181 // Returns the MIME type part of m_mimeTypeOverride if present and |
| 182 // successfully parsed, or returns one of the "Content-Type" header value | 182 // successfully parsed, or returns one of the "Content-Type" header value |
| 183 // of the received response. | 183 // of the received response. |
| 184 // | 184 // |
| 185 // This method is named after the term "final MIME type" defined in the | 185 // This method is named after the term "final MIME type" defined in the |
| 186 // spec but doesn't convert the result to ASCII lowercase as specified in | 186 // spec but doesn't convert the result to ASCII lowercase as specified in |
| 187 // the spec. Must be lowered later or compared using case insensitive | 187 // the spec. Must be lowered later or compared using case insensitive |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 bool m_sameOriginRequest; | 314 bool m_sameOriginRequest; |
| 315 // True iff the ongoing resource loading is using the downloadToFile | 315 // True iff the ongoing resource loading is using the downloadToFile |
| 316 // option. | 316 // option. |
| 317 bool m_downloadingToFile; | 317 bool m_downloadingToFile; |
| 318 bool m_responseTextOverflow; | 318 bool m_responseTextOverflow; |
| 319 }; | 319 }; |
| 320 | 320 |
| 321 } // namespace blink | 321 } // namespace blink |
| 322 | 322 |
| 323 #endif // XMLHttpRequest_h | 323 #endif // XMLHttpRequest_h |
| OLD | NEW |