Title: [243756] trunk

Diff

Modified: trunk/LayoutTests/ChangeLog (243755 => 243756)


--- trunk/LayoutTests/ChangeLog	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/ChangeLog	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,3 +1,16 @@
+2019-04-02  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, rolling out r243551.
+
+        Seems to have broken file uploads to SoundCloud
+
+        Reverted changeset:
+
+        "XMLHttpRequestUpload's loadstart event not correct
+        initialized"
+        https://bugs.webkit.org/show_bug.cgi?id=196174
+        https://trac.webkit.org/changeset/243551
+
 2019-04-02  Justin Fan  <justin_...@apple.com>
 
         [Web GPU] Implement blend states and color write mask for  GPUColorStateDescriptor

Modified: trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html (243755 => 243756)


--- trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html	2019-04-02 20:30:02 UTC (rev 243756)
@@ -26,15 +26,6 @@
             + "(" + e.loaded + " / " + e.total + "), expected (" + loaded + " / " + total + ")");
 }
 
-function onErrorProgressEvent(e)
-{
-    if (e.lengthComputable)
-        fail("Event " + e.type + " lengthComputable is true");
-    if (e.total != 0 || e.loaded != 0)
-        fail("Event " + e.type + " total/loaded values not matching: "
-            + "(" + e.loaded + " / " + e.total + "), expected (0 / 0)");
-}
-
 function onUnexpectedProgressEvent(e)
 {
     fail("unexpected ProgressEvent: " + e.type);
@@ -59,13 +50,13 @@
     var req = new XMLHttpRequest();
     req.upload._onerror_ = onUnexpectedProgressEvent;
     req.upload._onload_ = onUnexpectedProgressEvent;
-    req.upload._onabort_ = onErrorProgressEvent;
+    req.upload._onabort_ = onProgressEvent;
     req.upload._onprogress_ = function(e) {
         onProgressEvent(e);
         req.abort();
     }
     req.upload._onloadend_ = function(e) {
-        onErrorProgressEvent(e);
+        onProgressEvent(e);
         completeTest();
     }
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243755 => 243756)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,3 +1,16 @@
+2019-04-02  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, rolling out r243551.
+
+        Seems to have broken file uploads to SoundCloud
+
+        Reverted changeset:
+
+        "XMLHttpRequestUpload's loadstart event not correct
+        initialized"
+        https://bugs.webkit.org/show_bug.cgi?id=196174
+        https://trac.webkit.org/changeset/243551
+
 2019-04-01  Chris Dumez  <cdu...@apple.com>
 
         Attr nodes are not cloned properly

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/abort-during-upload-expected.txt (243755 => 243756)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/abort-during-upload-expected.txt	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/abort-during-upload-expected.txt	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,3 +1,3 @@
 
-PASS XMLHttpRequest: abort() while sending data 
+FAIL XMLHttpRequest: abort() while sending data assert_equals: expected "upload.loadstart(0,9999,true)" but got "upload.loadstart(0,0,false)"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-error-order.sub-expected.txt (243755 => 243756)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-error-order.sub-expected.txt	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-error-order.sub-expected.txt	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,4 +1,4 @@
 Blocked access to external URL http://nonexistent.localhost:8800/
 
-PASS XMLHttpRequest: event - error (order of events) 
+FAIL XMLHttpRequest: event - error (order of events) assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-error-order.sub.html (243755 => 243756)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-error-order.sub.html	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-error-order.sub.html	2019-04-02 20:30:02 UTC (rev 243756)
@@ -22,7 +22,7 @@
             xhr.addEventListener("loadend", function() {
                 test.step(function() {
                     // no progress events due to CORS failure
-                    assert_xhr_event_order_matches([1, "loadstart(0,0,false)", "upload.loadstart(0,12,true)", 4, "upload.error(0,0,false)", "upload.loadend(0,0,false)", "error(0,0,false)", "loadend(0,0,false)"]);
+                    assert_xhr_event_order_matches([1, "loadstart(0,0,false)", "upload.loadstart(0,12,true)", 2, 4, "upload.error(0,0,false)", "upload.loadend(0,0,false)", "error(0,0,false)", "loadend(0,0,false)"]);
                     test.done();
                 });
             });

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-loadstart-upload-expected.txt (243755 => 243756)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-loadstart-upload-expected.txt	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-loadstart-upload-expected.txt	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,3 +1,3 @@
 
-PASS XMLHttpRequest: The send() method: Fire a progress event named loadstart on upload object (synchronous flag is unset) 
+FAIL XMLHttpRequest: The send() method: Fire a progress event named loadstart on upload object (synchronous flag is unset) assert_equals: upload.onloadstart: event.total expected 7 but got 0
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-timeout-order-expected.txt (243755 => 243756)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-timeout-order-expected.txt	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-timeout-order-expected.txt	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,3 +1,3 @@
 
-PASS XMLHttpRequest: event - timeout (order of events) 
+FAIL XMLHttpRequest: event - timeout (order of events) assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/send-response-event-order-expected.txt (243755 => 243756)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/send-response-event-order-expected.txt	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/send-response-event-order-expected.txt	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,3 +1,3 @@
 
-PASS XMLHttpRequest: The send() method: event order when synchronous flag is unset 
+FAIL XMLHttpRequest: The send() method: event order when synchronous flag is unset assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)"
 

Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/event-error-order.sub-expected.txt (243755 => 243756)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/event-error-order.sub-expected.txt	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/event-error-order.sub-expected.txt	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,3 +1,3 @@
 
-PASS XMLHttpRequest: event - error (order of events) 
+FAIL XMLHttpRequest: event - error (order of events) assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)"
 

Modified: trunk/Source/WebCore/ChangeLog (243755 => 243756)


--- trunk/Source/WebCore/ChangeLog	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/Source/WebCore/ChangeLog	2019-04-02 20:30:02 UTC (rev 243756)
@@ -1,3 +1,16 @@
+2019-04-02  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, rolling out r243551.
+
+        Seems to have broken file uploads to SoundCloud
+
+        Reverted changeset:
+
+        "XMLHttpRequestUpload's loadstart event not correct
+        initialized"
+        https://bugs.webkit.org/show_bug.cgi?id=196174
+        https://trac.webkit.org/changeset/243551
+
 2019-04-02  Justin Fan  <justin_...@apple.com>
 
         [Web GPU] Implement blend states and color write mask for GPUColorStateDescriptor

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (243755 => 243756)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2019-04-02 20:30:02 UTC (rev 243756)
@@ -626,7 +626,7 @@
     if (m_async) {
         m_progressEventThrottle.dispatchProgressEvent(eventNames().loadstartEvent);
         if (!m_uploadComplete && m_uploadListenerFlag)
-            m_upload->dispatchProgressEvent(eventNames().loadstartEvent, 0, request.httpBody()->lengthInBytes());
+            m_upload->dispatchProgressEvent(eventNames().loadstartEvent);
 
         if (readyState() != OPENED || !m_sendFlag || m_loader)
             return { };
@@ -714,7 +714,6 @@
 void XMLHttpRequest::clearResponse()
 {
     m_response = ResourceResponse();
-    m_didReceiveResponseHandler = nullptr;
     clearResponseBuffers();
 }
 
@@ -946,22 +945,14 @@
     if (!m_upload)
         return;
 
-    if (m_response.isNull()) {
-        // We should not notify of progress until we've received a response from the server.
-        m_didReceiveResponseHandler = [this, bytesSent, totalBytesToBeSent] {
-            didSendData(bytesSent, totalBytesToBeSent);
-        };
-        return;
-    }
-
     if (m_uploadListenerFlag)
-        m_upload->dispatchProgressEvent(eventNames().progressEvent, bytesSent, totalBytesToBeSent);
+        m_upload->dispatchThrottledProgressEvent(true, bytesSent, totalBytesToBeSent);
 
     if (bytesSent == totalBytesToBeSent && !m_uploadComplete) {
         m_uploadComplete = true;
         if (m_uploadListenerFlag) {
-            m_upload->dispatchProgressEvent(eventNames().loadEvent, bytesSent, totalBytesToBeSent);
-            m_upload->dispatchProgressEvent(eventNames().loadendEvent, bytesSent, totalBytesToBeSent);
+            m_upload->dispatchProgressEvent(eventNames().loadEvent);
+            m_upload->dispatchProgressEvent(eventNames().loadendEvent);
         }
     }
 }
@@ -969,8 +960,6 @@
 void XMLHttpRequest::didReceiveResponse(unsigned long, const ResourceResponse& response)
 {
     m_response = response;
-    if (auto didReceiveResponseHandler = WTFMove(m_didReceiveResponseHandler))
-        didReceiveResponseHandler();
 }
 
 static inline bool shouldDecodeResponse(XMLHttpRequest::ResponseType type)
@@ -1058,13 +1047,6 @@
     if (!m_error) {
         m_receivedLength += len;
 
-        if (readyState() != LOADING)
-            changeState(LOADING);
-        else {
-            // Firefox calls readyStateChanged every time it receives data, 4449442
-            callReadyStateChangeListener();
-        }
-
         if (m_async) {
             long long expectedLength = m_response.expectedContentLength();
             bool lengthComputable = expectedLength > 0 && m_receivedLength <= expectedLength;
@@ -1071,6 +1053,12 @@
             unsigned long long total = lengthComputable ? expectedLength : 0;
             m_progressEventThrottle.dispatchThrottledProgressEvent(lengthComputable, m_receivedLength, total);
         }
+
+        if (readyState() != LOADING)
+            changeState(LOADING);
+        else
+            // Firefox calls readyStateChanged every time it receives data, 4449442
+            callReadyStateChangeListener();
     }
 }
 
@@ -1079,8 +1067,8 @@
     if (!m_uploadComplete) {
         m_uploadComplete = true;
         if (m_upload && m_uploadListenerFlag) {
-            m_upload->dispatchProgressEvent(type, 0, 0);
-            m_upload->dispatchProgressEvent(eventNames().loadendEvent, 0, 0);
+            m_upload->dispatchProgressEvent(type);
+            m_upload->dispatchProgressEvent(eventNames().loadendEvent);
         }
     }
     m_progressEventThrottle.dispatchProgressEvent(type);

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (243755 => 243756)


--- trunk/Source/WebCore/xml/XMLHttpRequest.h	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h	2019-04-02 20:30:02 UTC (rev 243756)
@@ -218,7 +218,6 @@
     String m_responseEncoding;
 
     ResourceResponse m_response;
-    Function<void()> m_didReceiveResponseHandler;
 
     RefPtr<TextResourceDecoder> m_decoder;
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp (243755 => 243756)


--- trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp	2019-04-02 20:30:02 UTC (rev 243756)
@@ -38,12 +38,26 @@
 {
 }
 
-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

Modified: trunk/Source/WebCore/xml/XMLHttpRequestUpload.h (243755 => 243756)


--- trunk/Source/WebCore/xml/XMLHttpRequestUpload.h	2019-04-02 19:59:55 UTC (rev 243755)
+++ trunk/Source/WebCore/xml/XMLHttpRequestUpload.h	2019-04-02 20:30:02 UTC (rev 243756)
@@ -38,7 +38,8 @@
     void ref() { m_request.ref(); }
     void deref() { m_request.deref(); }
 
-    void dispatchProgressEvent(const AtomicString& type, unsigned long long loaded, unsigned long long total);
+    void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
+    void dispatchProgressEvent(const AtomicString& type);
 
 private:
     void refEventTarget() final { ref(); }
@@ -48,6 +49,9 @@
     ScriptExecutionContext* scriptExecutionContext() const final { return m_request.scriptExecutionContext(); }
 
     XMLHttpRequest& m_request;
+    bool m_lengthComputable { false };
+    unsigned long long m_loaded { 0 };
+    unsigned long long m_total { 0 };
 };
     
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to