Changeset 161541 in webkit
- Timestamp:
- Jan 8, 2014 7:56:47 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 10 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r161539 r161541 1 2014-01-08 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r161532. 4 http://trac.webkit.org/changeset/161532 5 https://bugs.webkit.org/show_bug.cgi?id=126677 6 7 Caused lots of assertion failures (Requested by ap on 8 #webkit). 9 10 * fast/xmlhttprequest/xmlhttprequest-get-expected.txt: 11 * http/tests/xmlhttprequest/loadstart-event-init-expected.txt: Removed. 12 * http/tests/xmlhttprequest/loadstart-event-init.html: Removed. 13 * http/tests/xmlhttprequest/onabort-progressevent-attributes-expected.txt: Removed. 14 * http/tests/xmlhttprequest/onabort-progressevent-attributes.html: Removed. 15 * http/tests/xmlhttprequest/onload-progressevent-attributes-expected.txt: Removed. 16 * http/tests/xmlhttprequest/onload-progressevent-attributes.html: Removed. 17 * http/tests/xmlhttprequest/upload-onabort-progressevent-attributes-expected.txt: Removed. 18 * http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html: Removed. 19 * http/tests/xmlhttprequest/upload-onload-progressevent-attributes-expected.txt: Removed. 20 * http/tests/xmlhttprequest/upload-onload-progressevent-attributes.html: Removed. 21 1 22 2014-01-08 Jinwoo Song <jinwoo7.song@samsung.com> 2 23 -
trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt
r161532 r161541 54 54 [native code] 55 55 }' 56 lengthComputable : ' true'57 loaded : ' 174'58 position : ' 174'56 lengthComputable : 'false' 57 loaded : '0' 58 position : '0' 59 59 preventDefault : 'function preventDefault() { 60 60 [native code] … … 69 69 }' 70 70 target : '[object XMLHttpRequest]' 71 total : ' 174'72 totalSize : ' 174'71 total : '0' 72 totalSize : '0' 73 73 type : 'load' 74 74 -
trunk/Source/WebCore/ChangeLog
r161537 r161541 1 2014-01-08 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r161532. 4 http://trac.webkit.org/changeset/161532 5 https://bugs.webkit.org/show_bug.cgi?id=126677 6 7 Caused lots of assertion failures (Requested by ap on 8 #webkit). 9 10 * xml/XMLHttpRequest.cpp: 11 (WebCore::XMLHttpRequest::callReadyStateChangeListener): 12 (WebCore::XMLHttpRequest::createRequest): 13 (WebCore::XMLHttpRequest::abort): 14 (WebCore::XMLHttpRequest::networkError): 15 (WebCore::XMLHttpRequest::abortError): 16 (WebCore::XMLHttpRequest::didSendData): 17 (WebCore::XMLHttpRequest::didReceiveData): 18 (WebCore::XMLHttpRequest::didTimeout): 19 * xml/XMLHttpRequest.h: 20 * xml/XMLHttpRequestProgressEventThrottle.cpp: 21 (WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle): 22 (WebCore::XMLHttpRequestProgressEventThrottle::dispatchProgressEvent): 23 (WebCore::XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd): 24 (WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent): 25 (WebCore::XMLHttpRequestProgressEventThrottle::fired): 26 (WebCore::XMLHttpRequestProgressEventThrottle::hasEventToDispatch): 27 (WebCore::XMLHttpRequestProgressEventThrottle::suspend): 28 * xml/XMLHttpRequestProgressEventThrottle.h: 29 * xml/XMLHttpRequestUpload.cpp: 30 (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload): 31 (WebCore::XMLHttpRequestUpload::dispatchEventAndLoadEnd): 32 * xml/XMLHttpRequestUpload.h: 33 1 34 2014-01-08 Brian Burg <bburg@apple.com> 2 35 -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r161532 r161541 431 431 432 432 if (m_async || (m_state <= OPENED || m_state == DONE)) 433 m_progressEventThrottle.dispatchReadyStateChangeEvent( Event::create(eventNames().readystatechangeEvent, false, false), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);433 m_progressEventThrottle.dispatchReadyStateChangeEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent); 434 434 435 435 InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(cookie); 436 436 if (m_state == DONE && !m_error) { 437 437 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRLoadEvent(scriptExecutionContext(), this); 438 m_progressEventThrottle.dispatch ProgressEvent(eventNames().loadEvent);438 m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); 439 439 InspectorInstrumentation::didDispatchXHRLoadEvent(cookie); 440 m_progressEventThrottle.dispatch ProgressEvent(eventNames().loadendEvent);440 m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent)); 441 441 } 442 442 } … … 766 766 bool uploadEvents = false; 767 767 if (m_async) { 768 m_progressEventThrottle.dispatch ProgressEvent(eventNames().loadstartEvent);768 m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); 769 769 if (m_requestEntityBody && m_upload) { 770 770 uploadEvents = m_upload->hasEventListeners(); 771 m_upload->dispatch ProgressEvent(eventNames().loadstartEvent);771 m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); 772 772 } 773 773 } … … 863 863 } 864 864 865 dispatchErrorEvents(eventNames().abortEvent); 865 m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); 866 if (!m_uploadComplete) { 867 m_uploadComplete = true; 868 if (m_upload && m_uploadEventsAllowed) 869 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); 870 } 866 871 } 867 872 … … 924 929 { 925 930 genericError(); 926 dispatchErrorEvents(eventNames().errorEvent); 931 if (!m_uploadComplete) { 932 m_uploadComplete = true; 933 if (m_upload && m_uploadEventsAllowed) 934 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent)); 935 } 936 m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent)); 927 937 internalAbort(); 928 938 } … … 931 941 { 932 942 genericError(); 933 dispatchErrorEvents(eventNames().abortEvent); 943 if (!m_uploadComplete) { 944 m_uploadComplete = true; 945 if (m_upload && m_uploadEventsAllowed) 946 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); 947 } 948 m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); 934 949 } 935 950 … … 1165 1180 1166 1181 if (m_uploadEventsAllowed) 1167 m_upload->dispatchThrottledProgressEvent(true, bytesSent, totalBytesToBeSent); 1182 m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, true, bytesSent, totalBytesToBeSent)); 1183 1168 1184 if (bytesSent == totalBytesToBeSent && !m_uploadComplete) { 1169 1185 m_uploadComplete = true; 1170 if (m_uploadEventsAllowed) { 1171 m_upload->dispatchProgressEvent(eventNames().loadEvent); 1172 m_upload->dispatchProgressEvent(eventNames().loadendEvent); 1173 } 1186 if (m_uploadEventsAllowed) 1187 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); 1174 1188 } 1175 1189 } … … 1229 1243 1230 1244 if (!m_error) { 1245 long long expectedLength = m_response.expectedContentLength(); 1231 1246 m_receivedLength += len; 1232 1247 1233 1248 if (m_async) { 1234 long long expectedLength = m_response.expectedContentLength();1235 1249 bool lengthComputable = expectedLength > 0 && m_receivedLength <= expectedLength; 1236 1250 unsigned long long total = lengthComputable ? expectedLength : 0; 1237 m_progressEventThrottle.dispatch ThrottledProgressEvent(lengthComputable, m_receivedLength, total);1251 m_progressEventThrottle.dispatchProgressEvent(lengthComputable, m_receivedLength, total); 1238 1252 } 1239 1253 … … 1246 1260 } 1247 1261 1248 void XMLHttpRequest::dispatchErrorEvents(const AtomicString& type)1249 {1250 if (!m_uploadComplete) {1251 m_uploadComplete = true;1252 if (m_upload && m_uploadEventsAllowed) {1253 m_upload->dispatchProgressEvent(type);1254 m_upload->dispatchProgressEvent(eventNames().loadendEvent);1255 }1256 }1257 m_progressEventThrottle.dispatchProgressEvent(type);1258 m_progressEventThrottle.dispatchProgressEvent(eventNames().loadendEvent);1259 }1260 1261 1262 #if ENABLE(XHR_TIMEOUT) 1262 1263 void XMLHttpRequest::didTimeout() … … 1280 1281 changeState(DONE); 1281 1282 1282 dispatchErrorEvents(eventNames().timeoutEvent); 1283 if (!m_uploadComplete) { 1284 m_uploadComplete = true; 1285 if (m_upload && m_uploadEventsAllowed) 1286 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().timeoutEvent)); 1287 } 1288 m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().timeoutEvent)); 1283 1289 } 1284 1290 #endif -
trunk/Source/WebCore/xml/XMLHttpRequest.h
r161532 r161541 209 209 bool shouldDecodeResponse() const { return m_responseTypeCode < FirstBinaryResponseType; } 210 210 211 void dispatchErrorEvents(const AtomicString&);212 213 211 std::unique_ptr<XMLHttpRequestUpload> m_upload; 214 212 -
trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp
r161532 r161541 37 37 XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(EventTarget* target) 38 38 : m_target(target) 39 , m_hasThrottledProgressEvent(false)40 , m_lengthComputable(false)41 39 , m_loaded(0) 42 40 , m_total(0) … … 51 49 } 52 50 53 void XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total) 54 { 51 void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total) 52 { 53 if (m_deferEvents) { 54 // Only store the latest progress event while suspended. 55 m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total); 56 return; 57 } 58 59 if (!isActive()) { 60 // The timer is not active so the least frequent event for now is every byte. 61 // Just go ahead and dispatch the event. 62 63 // We should not have any pending loaded & total information from a previous run. 64 ASSERT(!m_loaded); 65 ASSERT(!m_total); 66 67 dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total)); 68 startRepeating(minimumProgressEventDispatchingIntervalInSeconds); 69 return; 70 } 71 72 // The timer is already active so minimumProgressEventDispatchingIntervalInSeconds is the least frequent event. 55 73 m_lengthComputable = lengthComputable; 56 74 m_loaded = loaded; 57 75 m_total = total; 58 59 if (m_deferEvents) {60 // Only store the latest progress event while suspended.61 m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total);62 return;63 }64 65 if (!isActive()) {66 // The timer is not active so the least frequent event for now is every byte.67 // Just go ahead and dispatch the event.68 69 // We should not have any pending loaded & total information from a previous run.70 ASSERT(!m_loaded);71 ASSERT(!m_total);72 73 dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total));74 startRepeating(minimumProgressEventDispatchingIntervalInSeconds);75 m_hasThrottledProgressEvent = false;76 return;77 }78 79 // The timer is already active so minimumProgressEventDispatchingIntervalInSeconds is the least frequent event.80 m_hasThrottledProgressEvent = true;81 76 } 82 77 … … 102 97 } 103 98 104 void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(const AtomicString &type) 105 { 106 ASSERT(type == eventNames().loadEvent || type == eventNames().loadstartEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent); 107 108 if (type == eventNames().loadstartEvent) { 109 m_lengthComputable = false; 110 m_loaded = 0; 111 m_total = 0; 112 } 113 114 dispatchEvent(XMLHttpRequestProgressEvent::create(type, m_lengthComputable, m_loaded, m_total)); 99 void XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd(PassRefPtr<Event> event) 100 { 101 ASSERT(event->type() == eventNames().loadEvent || event->type() == eventNames().abortEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().timeoutEvent); 102 103 dispatchEvent(event); 104 dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent)); 115 105 } 116 106 … … 126 116 if (!hasEventToDispatch()) 127 117 return; 118 128 119 PassRefPtr<Event> event = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total); 129 m_hasThrottledProgressEvent = false; 120 m_loaded = 0; 121 m_total = 0; 130 122 131 123 // We stop the timer as this is called when no more events are supposed to occur. … … 169 161 170 162 dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total)); 171 m_hasThrottledProgressEvent = false; 163 m_total = 0; 164 m_loaded = 0; 172 165 } 173 166 174 167 bool XMLHttpRequestProgressEventThrottle::hasEventToDispatch() const 175 168 { 176 return m_hasThrottledProgressEvent&& isActive();169 return (m_total || m_loaded) && isActive(); 177 170 } 178 171 … … 195 188 if (hasEventToDispatch()) { 196 189 m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total); 197 m_hasThrottledProgressEvent = false; 190 m_total = 0; 191 m_loaded = 0; 198 192 } 199 193 stop(); -
trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h
r161532 r161541 31 31 #include "wtf/PassRefPtr.h" 32 32 #include "wtf/Vector.h" 33 #include <wtf/Forward.h>34 33 35 34 namespace WebCore { … … 50 49 virtual ~XMLHttpRequestProgressEventThrottle(); 51 50 52 void dispatch ThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);51 void dispatchProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total); 53 52 void dispatchReadyStateChangeEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent); 54 53 void dispatchEvent(PassRefPtr<Event>); 55 void dispatch ProgressEvent(const AtomicString&);54 void dispatchEventAndLoadEnd(PassRefPtr<Event>); 56 55 57 56 void suspend(); … … 70 69 EventTarget* m_target; 71 70 72 bool m_hasThrottledProgressEvent;73 71 bool m_lengthComputable; 74 72 unsigned long long m_loaded; -
trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp
r161532 r161541 37 37 XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest) 38 38 : m_xmlHttpRequest(xmlHttpRequest) 39 , m_lengthComputable(false)40 , m_loaded(0)41 , m_total(0)42 39 { 43 40 } 44 41 45 void XMLHttpRequestUpload::dispatch ThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)42 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(PassRefPtr<Event> event) 46 43 { 47 m_lengthComputable = lengthComputable; 48 m_loaded = loaded; 49 m_total = total; 44 ASSERT(event->type() == eventNames().loadEvent || event->type() == eventNames().abortEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().timeoutEvent); 50 45 51 dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total)); 52 } 53 54 void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString &type) 55 { 56 ASSERT(type == eventNames().loadEvent || type == eventNames().loadstartEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent); 57 58 if (type == eventNames().loadstartEvent) { 59 m_lengthComputable = false; 60 m_loaded = 0; 61 m_total = 0; 62 } 63 64 dispatchEvent(XMLHttpRequestProgressEvent::create(type, m_lengthComputable, m_loaded, m_total)); 46 dispatchEvent(event); 47 dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent)); 65 48 } 66 49 67 50 51 68 52 } // namespace WebCore -
trunk/Source/WebCore/xml/XMLHttpRequestUpload.h
r161532 r161541 56 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); 57 57 58 void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total); 59 void dispatchProgressEvent(const AtomicString &type); 58 void dispatchEventAndLoadEnd(PassRefPtr<Event>); 60 59 61 60 private: … … 64 63 65 64 XMLHttpRequest* m_xmlHttpRequest; 66 bool m_lengthComputable;67 unsigned long long m_loaded;68 unsigned long long m_total;69 65 }; 70 66
Note: See TracChangeset
for help on using the changeset viewer.