Ignore:
Timestamp:
Jul 15, 2021, 3:52:51 PM (4 years ago)
Author:
Chris Dumez
Message:

Sync XHR 'load' event is always has total/loaded=0
https://bugs.webkit.org/show_bug.cgi?id=228004

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT test that is now passing.

  • web-platform-tests/xhr/send-sync-response-event-order-expected.txt:

Source/WebCore:

XMLHttpRequest::didReceiveData() was not calling XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent()
for sync XHRs because we don't want to fire 'progress' events for sync XHR. However, dispatchThrottledProgressEvent()
also updates XMLHttpRequestProgressEventThrottle's m_loaded / m_total members and we do want those to get updated for
sync XHRs, since they get used later on for the 'load' event.

No new tests, rebaselined existing test.

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::didReceiveData):

  • xml/XMLHttpRequestProgressEventThrottle.cpp:

(WebCore::XMLHttpRequestProgressEventThrottle::updateProgress):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent): Deleted.

  • xml/XMLHttpRequestProgressEventThrottle.h:
File:
1 edited

Legend:

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

    r258159 r279967  
    4646XMLHttpRequestProgressEventThrottle::~XMLHttpRequestProgressEventThrottle() = default;
    4747
    48 void XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)
     48void XMLHttpRequestProgressEventThrottle::updateProgress(bool isAsync, bool lengthComputable, unsigned long long loaded, unsigned long long total)
    4949{
    5050    m_lengthComputable = lengthComputable;
     
    5252    m_total = total;
    5353
    54     if (!m_target.hasEventListeners(eventNames().progressEvent))
     54    if (!isAsync || !m_target.hasEventListeners(eventNames().progressEvent))
    5555        return;
    5656
Note: See TracChangeset for help on using the changeset viewer.