OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> | 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> |
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> | 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> |
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. |
6 * Copyright (C) 2012 Intel Corporation | 6 * Copyright (C) 2012 Intel Corporation |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 , m_error(false) | 174 , m_error(false) |
175 , m_uploadEventsAllowed(true) | 175 , m_uploadEventsAllowed(true) |
176 , m_uploadComplete(false) | 176 , m_uploadComplete(false) |
177 , m_sameOriginRequest(true) | 177 , m_sameOriginRequest(true) |
178 , m_allowCrossOriginRequests(false) | 178 , m_allowCrossOriginRequests(false) |
179 , m_receivedLength(0) | 179 , m_receivedLength(0) |
180 , m_lastSendLineNumber(0) | 180 , m_lastSendLineNumber(0) |
181 , m_exceptionCode(0) | 181 , m_exceptionCode(0) |
182 , m_progressEventThrottle(this) | 182 , m_progressEventThrottle(this) |
183 , m_responseTypeCode(ResponseTypeDefault) | 183 , m_responseTypeCode(ResponseTypeDefault) |
| 184 , m_protectionTimer(this, &XMLHttpRequest::dropProtection) |
184 , m_securityOrigin(securityOrigin) | 185 , m_securityOrigin(securityOrigin) |
185 { | 186 { |
186 initializeXMLHttpRequestStaticData(); | 187 initializeXMLHttpRequestStaticData(); |
187 #ifndef NDEBUG | 188 #ifndef NDEBUG |
188 xmlHttpRequestCounter.increment(); | 189 xmlHttpRequestCounter.increment(); |
189 #endif | 190 #endif |
190 ScriptWrappable::init(this); | 191 ScriptWrappable::init(this); |
191 } | 192 } |
192 | 193 |
193 XMLHttpRequest::~XMLHttpRequest() | 194 XMLHttpRequest::~XMLHttpRequest() |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 if (hadLoader) { | 828 if (hadLoader) { |
828 m_loader->cancel(); | 829 m_loader->cancel(); |
829 m_loader = 0; | 830 m_loader = 0; |
830 } | 831 } |
831 | 832 |
832 m_decoder = 0; | 833 m_decoder = 0; |
833 | 834 |
834 InspectorInstrumentation::didFailXHRLoading(scriptExecutionContext(), this); | 835 InspectorInstrumentation::didFailXHRLoading(scriptExecutionContext(), this); |
835 | 836 |
836 if (hadLoader) | 837 if (hadLoader) |
837 dropProtection(); | 838 dropProtectionSoon(); |
838 } | 839 } |
839 | 840 |
840 void XMLHttpRequest::clearResponse() | 841 void XMLHttpRequest::clearResponse() |
841 { | 842 { |
842 m_response = ResourceResponse(); | 843 m_response = ResourceResponse(); |
843 clearResponseBuffers(); | 844 clearResponseBuffers(); |
844 } | 845 } |
845 | 846 |
846 void XMLHttpRequest::clearResponseBuffers() | 847 void XMLHttpRequest::clearResponseBuffers() |
847 { | 848 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 { | 885 { |
885 genericError(); | 886 genericError(); |
886 m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent:
:create(eventNames().abortEvent)); | 887 m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent:
:create(eventNames().abortEvent)); |
887 if (!m_uploadComplete) { | 888 if (!m_uploadComplete) { |
888 m_uploadComplete = true; | 889 m_uploadComplete = true; |
889 if (m_upload && m_uploadEventsAllowed) | 890 if (m_upload && m_uploadEventsAllowed) |
890 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::creat
e(eventNames().abortEvent)); | 891 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::creat
e(eventNames().abortEvent)); |
891 } | 892 } |
892 } | 893 } |
893 | 894 |
894 void XMLHttpRequest::dropProtection() | 895 void XMLHttpRequest::dropProtectionSoon() |
895 { | 896 { |
| 897 if (m_protectionTimer.isActive()) |
| 898 return; |
| 899 m_protectionTimer.startOneShot(0); |
| 900 } |
896 | 901 |
| 902 void XMLHttpRequest::dropProtection(Timer<XMLHttpRequest>*) |
| 903 { |
897 unsetPendingActivity(this); | 904 unsetPendingActivity(this); |
898 } | 905 } |
899 | 906 |
900 void XMLHttpRequest::overrideMimeType(const String& override) | 907 void XMLHttpRequest::overrideMimeType(const String& override) |
901 { | 908 { |
902 m_mimeTypeOverride = override; | 909 m_mimeTypeOverride = override; |
903 } | 910 } |
904 | 911 |
905 void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& va
lue, ExceptionCode& ec) | 912 void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& va
lue, ExceptionCode& ec) |
906 { | 913 { |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 info.addMember(m_responseDocument, "responseDocument"); | 1290 info.addMember(m_responseDocument, "responseDocument"); |
1284 info.addMember(m_binaryResponseBuilder, "binaryResponseBuilder"); | 1291 info.addMember(m_binaryResponseBuilder, "binaryResponseBuilder"); |
1285 info.addMember(m_responseArrayBuffer, "responseArrayBuffer"); | 1292 info.addMember(m_responseArrayBuffer, "responseArrayBuffer"); |
1286 info.addMember(m_lastSendURL, "lastSendURL"); | 1293 info.addMember(m_lastSendURL, "lastSendURL"); |
1287 info.addMember(m_eventTargetData, "eventTargetData"); | 1294 info.addMember(m_eventTargetData, "eventTargetData"); |
1288 info.addMember(m_progressEventThrottle, "progressEventThrottle"); | 1295 info.addMember(m_progressEventThrottle, "progressEventThrottle"); |
1289 info.addMember(m_securityOrigin, "securityOrigin"); | 1296 info.addMember(m_securityOrigin, "securityOrigin"); |
1290 } | 1297 } |
1291 | 1298 |
1292 } // namespace WebCore | 1299 } // namespace WebCore |
OLD | NEW |