Changeset 243756 in webkit
- Timestamp:
- Apr 2, 2019 1:30:02 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r243755 r243756 1 2019-04-02 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r243551. 4 5 Seems to have broken file uploads to SoundCloud 6 7 Reverted changeset: 8 9 "XMLHttpRequestUpload's loadstart event not correct 10 initialized" 11 https://bugs.webkit.org/show_bug.cgi?id=196174 12 https://trac.webkit.org/changeset/243551 13 1 14 2019-04-02 Justin Fan <justin_fan@apple.com> 2 15 -
trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html
r243551 r243756 27 27 } 28 28 29 function onErrorProgressEvent(e)30 {31 if (e.lengthComputable)32 fail("Event " + e.type + " lengthComputable is true");33 if (e.total != 0 || e.loaded != 0)34 fail("Event " + e.type + " total/loaded values not matching: "35 + "(" + e.loaded + " / " + e.total + "), expected (0 / 0)");36 }37 38 29 function onUnexpectedProgressEvent(e) 39 30 { … … 60 51 req.upload.onerror = onUnexpectedProgressEvent; 61 52 req.upload.onload = onUnexpectedProgressEvent; 62 req.upload.onabort = on ErrorProgressEvent;53 req.upload.onabort = onProgressEvent; 63 54 req.upload.onprogress = function(e) { 64 55 onProgressEvent(e); … … 66 57 } 67 58 req.upload.onloadend = function(e) { 68 on ErrorProgressEvent(e);59 onProgressEvent(e); 69 60 completeTest(); 70 61 } -
trunk/LayoutTests/imported/w3c/ChangeLog
r243734 r243756 1 2019-04-02 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r243551. 4 5 Seems to have broken file uploads to SoundCloud 6 7 Reverted changeset: 8 9 "XMLHttpRequestUpload's loadstart event not correct 10 initialized" 11 https://bugs.webkit.org/show_bug.cgi?id=196174 12 https://trac.webkit.org/changeset/243551 13 1 14 2019-04-01 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/abort-during-upload-expected.txt
r243551 r243756 1 1 2 PASS XMLHttpRequest: abort() while sending data 2 FAIL XMLHttpRequest: abort() while sending data assert_equals: expected "upload.loadstart(0,9999,true)" but got "upload.loadstart(0,0,false)" 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-error-order.sub-expected.txt
r243551 r243756 1 1 Blocked access to external URL http://nonexistent.localhost:8800/ 2 2 3 PASS XMLHttpRequest: event - error (order of events) 3 FAIL XMLHttpRequest: event - error (order of events) assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)" 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-error-order.sub.html
r243551 r243756 23 23 test.step(function() { 24 24 // no progress events due to CORS failure 25 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)"]);25 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)"]); 26 26 test.done(); 27 27 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-loadstart-upload-expected.txt
r243551 r243756 1 1 2 PASS XMLHttpRequest: The send() method: Fire a progress event named loadstart on upload object (synchronous flag is unset) 2 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 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/event-timeout-order-expected.txt
r243551 r243756 1 1 2 PASS XMLHttpRequest: event - timeout (order of events) 2 FAIL XMLHttpRequest: event - timeout (order of events) assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)" 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/send-response-event-order-expected.txt
r243551 r243756 1 1 2 PASS XMLHttpRequest: The send() method: event order when synchronous flag is unset 2 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)" 3 3 -
trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/event-error-order.sub-expected.txt
r243551 r243756 1 1 2 PASS XMLHttpRequest: event - error (order of events) 2 FAIL XMLHttpRequest: event - error (order of events) assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)" 3 3 -
trunk/Source/WebCore/ChangeLog
r243755 r243756 1 2019-04-02 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r243551. 4 5 Seems to have broken file uploads to SoundCloud 6 7 Reverted changeset: 8 9 "XMLHttpRequestUpload's loadstart event not correct 10 initialized" 11 https://bugs.webkit.org/show_bug.cgi?id=196174 12 https://trac.webkit.org/changeset/243551 13 1 14 2019-04-02 Justin Fan <justin_fan@apple.com> 2 15 -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r243551 r243756 627 627 m_progressEventThrottle.dispatchProgressEvent(eventNames().loadstartEvent); 628 628 if (!m_uploadComplete && m_uploadListenerFlag) 629 m_upload->dispatchProgressEvent(eventNames().loadstartEvent , 0, request.httpBody()->lengthInBytes());629 m_upload->dispatchProgressEvent(eventNames().loadstartEvent); 630 630 631 631 if (readyState() != OPENED || !m_sendFlag || m_loader) … … 715 715 { 716 716 m_response = ResourceResponse(); 717 m_didReceiveResponseHandler = nullptr;718 717 clearResponseBuffers(); 719 718 } … … 947 946 return; 948 947 949 if (m_response.isNull()) {950 // We should not notify of progress until we've received a response from the server.951 m_didReceiveResponseHandler = [this, bytesSent, totalBytesToBeSent] {952 didSendData(bytesSent, totalBytesToBeSent);953 };954 return;955 }956 957 948 if (m_uploadListenerFlag) 958 m_upload->dispatch ProgressEvent(eventNames().progressEvent, bytesSent, totalBytesToBeSent);949 m_upload->dispatchThrottledProgressEvent(true, bytesSent, totalBytesToBeSent); 959 950 960 951 if (bytesSent == totalBytesToBeSent && !m_uploadComplete) { 961 952 m_uploadComplete = true; 962 953 if (m_uploadListenerFlag) { 963 m_upload->dispatchProgressEvent(eventNames().loadEvent , bytesSent, totalBytesToBeSent);964 m_upload->dispatchProgressEvent(eventNames().loadendEvent , bytesSent, totalBytesToBeSent);954 m_upload->dispatchProgressEvent(eventNames().loadEvent); 955 m_upload->dispatchProgressEvent(eventNames().loadendEvent); 965 956 } 966 957 } … … 970 961 { 971 962 m_response = response; 972 if (auto didReceiveResponseHandler = WTFMove(m_didReceiveResponseHandler))973 didReceiveResponseHandler();974 963 } 975 964 … … 1059 1048 m_receivedLength += len; 1060 1049 1061 if (readyState() != LOADING)1062 changeState(LOADING);1063 else {1064 // Firefox calls readyStateChanged every time it receives data, 44494421065 callReadyStateChangeListener();1066 }1067 1068 1050 if (m_async) { 1069 1051 long long expectedLength = m_response.expectedContentLength(); … … 1072 1054 m_progressEventThrottle.dispatchThrottledProgressEvent(lengthComputable, m_receivedLength, total); 1073 1055 } 1056 1057 if (readyState() != LOADING) 1058 changeState(LOADING); 1059 else 1060 // Firefox calls readyStateChanged every time it receives data, 4449442 1061 callReadyStateChangeListener(); 1074 1062 } 1075 1063 } … … 1080 1068 m_uploadComplete = true; 1081 1069 if (m_upload && m_uploadListenerFlag) { 1082 m_upload->dispatchProgressEvent(type , 0, 0);1083 m_upload->dispatchProgressEvent(eventNames().loadendEvent , 0, 0);1070 m_upload->dispatchProgressEvent(type); 1071 m_upload->dispatchProgressEvent(eventNames().loadendEvent); 1084 1072 } 1085 1073 } -
trunk/Source/WebCore/xml/XMLHttpRequest.h
r243551 r243756 219 219 220 220 ResourceResponse m_response; 221 Function<void()> m_didReceiveResponseHandler;222 221 223 222 RefPtr<TextResourceDecoder> m_decoder; -
trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp
r243551 r243756 39 39 } 40 40 41 void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString& type, unsigned long long loaded, unsigned long long total) 41 void XMLHttpRequestUpload::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total) 42 { 43 m_lengthComputable = lengthComputable; 44 m_loaded = loaded; 45 m_total = total; 46 47 dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total)); 48 } 49 50 void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString& type) 42 51 { 43 52 ASSERT(type == eventNames().loadstartEvent || type == eventNames().progressEvent || type == eventNames().loadEvent || type == eventNames().loadendEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent); 44 53 45 // https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface 46 dispatchEvent(XMLHttpRequestProgressEvent::create(type, !!total, loaded, total)); 54 if (type == eventNames().loadstartEvent) { 55 m_lengthComputable = false; 56 m_loaded = 0; 57 m_total = 0; 58 } 59 60 dispatchEvent(XMLHttpRequestProgressEvent::create(type, m_lengthComputable, m_loaded, m_total)); 47 61 } 48 62 -
trunk/Source/WebCore/xml/XMLHttpRequestUpload.h
r243551 r243756 39 39 void deref() { m_request.deref(); } 40 40 41 void dispatchProgressEvent(const AtomicString& type, unsigned long long loaded, unsigned long long total); 41 void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total); 42 void dispatchProgressEvent(const AtomicString& type); 42 43 43 44 private: … … 49 50 50 51 XMLHttpRequest& m_request; 52 bool m_lengthComputable { false }; 53 unsigned long long m_loaded { 0 }; 54 unsigned long long m_total { 0 }; 51 55 }; 52 56
Note: See TracChangeset
for help on using the changeset viewer.