Changeset 161541 in webkit


Ignore:
Timestamp:
Jan 8, 2014 7:56:47 PM (10 years ago)
Author:
commit-queue@webkit.org
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.
Location:
trunk
Files:
10 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r161539 r161541  
     12014-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
    1222014-01-08  Jinwoo Song  <jinwoo7.song@samsung.com>
    223
  • trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt

    r161532 r161541  
    5454    [native code]
    5555}'
    56 lengthComputable : 'true'
    57 loaded : '174'
    58 position : '174'
     56lengthComputable : 'false'
     57loaded : '0'
     58position : '0'
    5959preventDefault : 'function preventDefault() {
    6060    [native code]
     
    6969}'
    7070target : '[object XMLHttpRequest]'
    71 total : '174'
    72 totalSize : '174'
     71total : '0'
     72totalSize : '0'
    7373type : 'load'
    7474
  • trunk/Source/WebCore/ChangeLog

    r161537 r161541  
     12014-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
    1342014-01-08  Brian Burg  <bburg@apple.com>
    235
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r161532 r161541  
    431431
    432432    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);
    434434
    435435    InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(cookie);
    436436    if (m_state == DONE && !m_error) {
    437437        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRLoadEvent(scriptExecutionContext(), this);
    438         m_progressEventThrottle.dispatchProgressEvent(eventNames().loadEvent);
     438        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent));
    439439        InspectorInstrumentation::didDispatchXHRLoadEvent(cookie);
    440         m_progressEventThrottle.dispatchProgressEvent(eventNames().loadendEvent);
     440        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
    441441    }
    442442}
     
    766766    bool uploadEvents = false;
    767767    if (m_async) {
    768         m_progressEventThrottle.dispatchProgressEvent(eventNames().loadstartEvent);
     768        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent));
    769769        if (m_requestEntityBody && m_upload) {
    770770            uploadEvents = m_upload->hasEventListeners();
    771             m_upload->dispatchProgressEvent(eventNames().loadstartEvent);
     771            m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent));
    772772        }
    773773    }
     
    863863    }
    864864
    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    }
    866871}
    867872
     
    924929{
    925930    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));
    927937    internalAbort();
    928938}
     
    931941{
    932942    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));
    934949}
    935950
     
    11651180
    11661181    if (m_uploadEventsAllowed)
    1167         m_upload->dispatchThrottledProgressEvent(true, bytesSent, totalBytesToBeSent);
     1182        m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, true, bytesSent, totalBytesToBeSent));
     1183
    11681184    if (bytesSent == totalBytesToBeSent && !m_uploadComplete) {
    11691185        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));
    11741188    }
    11751189}
     
    12291243
    12301244    if (!m_error) {
     1245        long long expectedLength = m_response.expectedContentLength();
    12311246        m_receivedLength += len;
    12321247
    12331248        if (m_async) {
    1234             long long expectedLength = m_response.expectedContentLength();
    12351249            bool lengthComputable = expectedLength > 0 && m_receivedLength <= expectedLength;
    12361250            unsigned long long total = lengthComputable ? expectedLength : 0;
    1237             m_progressEventThrottle.dispatchThrottledProgressEvent(lengthComputable, m_receivedLength, total);
     1251            m_progressEventThrottle.dispatchProgressEvent(lengthComputable, m_receivedLength, total);
    12381252        }
    12391253
     
    12461260}
    12471261
    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 
    12611262#if ENABLE(XHR_TIMEOUT)
    12621263void XMLHttpRequest::didTimeout()
     
    12801281    changeState(DONE);
    12811282
    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));
    12831289}
    12841290#endif
  • trunk/Source/WebCore/xml/XMLHttpRequest.h

    r161532 r161541  
    209209    bool shouldDecodeResponse() const { return m_responseTypeCode < FirstBinaryResponseType; }
    210210
    211     void dispatchErrorEvents(const AtomicString&);
    212 
    213211    std::unique_ptr<XMLHttpRequestUpload> m_upload;
    214212
  • 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();
  • trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h

    r161532 r161541  
    3131#include "wtf/PassRefPtr.h"
    3232#include "wtf/Vector.h"
    33 #include <wtf/Forward.h>
    3433
    3534namespace WebCore {
     
    5049    virtual ~XMLHttpRequestProgressEventThrottle();
    5150
    52     void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
     51    void dispatchProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
    5352    void dispatchReadyStateChangeEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);
    5453    void dispatchEvent(PassRefPtr<Event>);
    55     void dispatchProgressEvent(const AtomicString&);
     54    void dispatchEventAndLoadEnd(PassRefPtr<Event>);
    5655
    5756    void suspend();
     
    7069    EventTarget* m_target;
    7170
    72     bool m_hasThrottledProgressEvent;
    7371    bool m_lengthComputable;
    7472    unsigned long long m_loaded;
  • trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp

    r161532 r161541  
    3737XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest)
    3838    : m_xmlHttpRequest(xmlHttpRequest)
    39     , m_lengthComputable(false)
    40     , m_loaded(0)
    41     , m_total(0)
    4239{
    4340}
    4441
    45 void XMLHttpRequestUpload::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)
     42void XMLHttpRequestUpload::dispatchEventAndLoadEnd(PassRefPtr<Event> event)
    4643{
    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);
    5045
    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));
    6548}
    6649
    6750
     51
    6852} // namespace WebCore
  • trunk/Source/WebCore/xml/XMLHttpRequestUpload.h

    r161532 r161541  
    5656        DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
    5757
    58         void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
    59         void dispatchProgressEvent(const AtomicString &type);
     58        void dispatchEventAndLoadEnd(PassRefPtr<Event>);
    6059
    6160    private:
     
    6463
    6564        XMLHttpRequest* m_xmlHttpRequest;
    66         bool m_lengthComputable;
    67         unsigned long long m_loaded;
    68         unsigned long long m_total;
    6965    };
    7066   
Note: See TracChangeset for help on using the changeset viewer.