Ignore:
Timestamp:
Jan 8, 2014, 7:56:47 PM (11 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r161532.
http://trac.webkit.org/changeset/161532
https://bugs.webkit.org/show_bug.cgi?id=126677

Caused lots of assertion failures (Requested by ap on
#webkit).

Source/WebCore:

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::callReadyStateChangeListener):
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::abort):
(WebCore::XMLHttpRequest::networkError):
(WebCore::XMLHttpRequest::abortError):
(WebCore::XMLHttpRequest::didSendData):
(WebCore::XMLHttpRequest::didReceiveData):
(WebCore::XMLHttpRequest::didTimeout):

  • xml/XMLHttpRequest.h:
  • xml/XMLHttpRequestProgressEventThrottle.cpp:

(WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchProgressEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd):
(WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::fired):
(WebCore::XMLHttpRequestProgressEventThrottle::hasEventToDispatch):
(WebCore::XMLHttpRequestProgressEventThrottle::suspend):

  • xml/XMLHttpRequestProgressEventThrottle.h:
  • xml/XMLHttpRequestUpload.cpp:

(WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
(WebCore::XMLHttpRequestUpload::dispatchEventAndLoadEnd):

  • xml/XMLHttpRequestUpload.h:

LayoutTests:

  • fast/xmlhttprequest/xmlhttprequest-get-expected.txt:
  • http/tests/xmlhttprequest/loadstart-event-init-expected.txt: Removed.
  • http/tests/xmlhttprequest/loadstart-event-init.html: Removed.
  • http/tests/xmlhttprequest/onabort-progressevent-attributes-expected.txt: Removed.
  • http/tests/xmlhttprequest/onabort-progressevent-attributes.html: Removed.
  • http/tests/xmlhttprequest/onload-progressevent-attributes-expected.txt: Removed.
  • http/tests/xmlhttprequest/onload-progressevent-attributes.html: Removed.
  • http/tests/xmlhttprequest/upload-onabort-progressevent-attributes-expected.txt: Removed.
  • http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html: Removed.
  • http/tests/xmlhttprequest/upload-onload-progressevent-attributes-expected.txt: Removed.
  • http/tests/xmlhttprequest/upload-onload-progressevent-attributes.html: Removed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp

    r161532 r161541  
    3737XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(EventTarget* target)
    3838    : m_target(target)
    39     , m_hasThrottledProgressEvent(false)
    40     , m_lengthComputable(false)
    4139    , m_loaded(0)
    4240    , m_total(0)
     
    5149}
    5250
    53 void XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)
    54 {
     51void 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.
    5573    m_lengthComputable = lengthComputable;
    5674    m_loaded = loaded;
    5775    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;
    8176}
    8277
     
    10297}
    10398
    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));
     99void 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));
    115105}
    116106
     
    126116    if (!hasEventToDispatch())
    127117        return;
     118
    128119    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;
    130122
    131123    // We stop the timer as this is called when no more events are supposed to occur.
     
    169161
    170162    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
    171     m_hasThrottledProgressEvent = false;
     163    m_total = 0;
     164    m_loaded = 0;
    172165}
    173166
    174167bool XMLHttpRequestProgressEventThrottle::hasEventToDispatch() const
    175168{
    176     return m_hasThrottledProgressEvent && isActive();
     169    return (m_total || m_loaded) && isActive();
    177170}
    178171
     
    195188    if (hasEventToDispatch()) {
    196189        m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total);
    197         m_hasThrottledProgressEvent = false;
     190        m_total = 0;
     191        m_loaded = 0;
    198192    }
    199193    stop();
Note: See TracChangeset for help on using the changeset viewer.