Index: Source/core/xml/XMLHttpRequest.cpp |
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp |
index 2aa1a4c2553ad34a26eb31a3f5404708b4d3c8e7..a006abd2cec3c89b58d5d641e23786bfc95e481b 100644 |
--- a/Source/core/xml/XMLHttpRequest.cpp |
+++ b/Source/core/xml/XMLHttpRequest.cpp |
@@ -965,6 +965,15 @@ void XMLHttpRequest::dispatchEventAndLoadEnd(const AtomicString& type) |
m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(type)); |
} |
+void XMLHttpRequest::dispatchThrottledProgressEvent() |
+{ |
+ long long expectedLength = m_response.expectedContentLength(); |
+ bool lengthComputable = expectedLength > 0 && m_receivedLength <= expectedLength; |
+ unsigned long long total = lengthComputable ? expectedLength : 0; |
+ |
+ m_progressEventThrottle.dispatchProgressEvent(lengthComputable, m_receivedLength, total); |
+} |
+ |
void XMLHttpRequest::handleNetworkError() |
{ |
LOG(Network, "XMLHttpRequest %p handleNetworkError()", this); |
@@ -1298,13 +1307,8 @@ void XMLHttpRequest::didReceiveData(const char* data, int len) |
m_receivedLength += len; |
- if (m_async) { |
- long long expectedLength = m_response.expectedContentLength(); |
- bool lengthComputable = expectedLength > 0 && m_receivedLength <= expectedLength; |
- unsigned long long total = lengthComputable ? expectedLength : 0; |
- |
- m_progressEventThrottle.dispatchProgressEvent(lengthComputable, m_receivedLength, total); |
- } |
+ if (m_async) |
+ dispatchThrottledProgressEvent(); |
if (m_state != LOADING) { |
changeState(LOADING); |