Unreviewed, rolling out r243551.
[WebKit-https.git] / Source / WebCore / xml / XMLHttpRequestUpload.cpp
index f8b9518..8c06583 100644 (file)
@@ -38,12 +38,26 @@ XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest& request)
 {
 }
 
-void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString& type, unsigned long long loaded, unsigned long long total)
+void XMLHttpRequestUpload::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)
+{
+    m_lengthComputable = lengthComputable;
+    m_loaded = loaded;
+    m_total = total;
+
+    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total));
+}
+
+void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString& type)
 {
     ASSERT(type == eventNames().loadstartEvent || type == eventNames().progressEvent || type == eventNames().loadEvent || type == eventNames().loadendEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent);
 
-    // https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface
-    dispatchEvent(XMLHttpRequestProgressEvent::create(type, !!total, loaded, total));
+    if (type == eventNames().loadstartEvent) {
+        m_lengthComputable = false;
+        m_loaded = 0;
+        m_total = 0;
+    }
+
+    dispatchEvent(XMLHttpRequestProgressEvent::create(type, m_lengthComputable, m_loaded, m_total));
 }
 
 } // namespace WebCore