XMLHttpRequestUpload's loadstart event not correct initialized
[WebKit-https.git] / Source / WebCore / xml / XMLHttpRequestUpload.cpp
index 8c06583..f8b9518 100644 (file)
@@ -38,26 +38,12 @@ XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest& request)
 {
 }
 
-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)
+void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString& type, unsigned long long loaded, unsigned long long total)
 {
     ASSERT(type == eventNames().loadstartEvent || type == eventNames().progressEvent || type == eventNames().loadEvent || type == eventNames().loadendEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent);
 
-    if (type == eventNames().loadstartEvent) {
-        m_lengthComputable = false;
-        m_loaded = 0;
-        m_total = 0;
-    }
-
-    dispatchEvent(XMLHttpRequestProgressEvent::create(type, m_lengthComputable, m_loaded, m_total));
+    // https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface
+    dispatchEvent(XMLHttpRequestProgressEvent::create(type, !!total, loaded, total));
 }
 
 } // namespace WebCore