Ignore:
Timestamp:
Dec 22, 2011, 12:55:04 AM (13 years ago)
Author:
[email protected]
Message:

Onloadend event is not supported in XMLHttpRequest
https://bugs.webkit.org/show_bug.cgi?id=40952

Patch by Hans Muller <[email protected]> on 2011-12-22
Reviewed by Julien Chaffraix.

Source/WebCore:

Added support for the loadend ProgressEvent to XMLHttpRequest and XMLHttpRequestUpload.
A new method, dispatchEventAndLoadEnd(), was added to XMLHttpRequestProgressEventThrottle
and XMLHttpRequestUpload to foolproof the common case of dispatching a load, abort,
or error event followed by a loadend event.

Tests: http/tests/xmlhttprequest/onloadend-event-after-abort.html

http/tests/xmlhttprequest/onloadend-event-after-error.html
http/tests/xmlhttprequest/onloadend-event-after-load.html
http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html
http/tests/xmlhttprequest/upload-onloadend-event-after-abort.html
http/tests/xmlhttprequest/upload-onloadend-event-after-load.html
http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::callReadyStateChangeListener):
(WebCore::XMLHttpRequest::abort):
(WebCore::XMLHttpRequest::networkError):
(WebCore::XMLHttpRequest::abortError):
(WebCore::XMLHttpRequest::didSendData):

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

(WebCore::XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd):

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

(WebCore::XMLHttpRequestUpload::dispatchEventAndLoadEnd):

  • xml/XMLHttpRequestUpload.h:
  • xml/XMLHttpRequestUpload.idl:

LayoutTests:

Added support for the loadend ProgresEvent to XMLHttpRequest and XMLHttpRequestUpload.
The new tests verify that a loadend progress event is dispatched after a load, abort,
or error progress event for both synchronous and asynchronous requests.

  • http/tests/xmlhttprequest/onloadend-event-after-abort-expected.txt: Added.
  • http/tests/xmlhttprequest/onloadend-event-after-abort.html: Added.
  • http/tests/xmlhttprequest/onloadend-event-after-error-expected.txt: Added.
  • http/tests/xmlhttprequest/onloadend-event-after-error.html: Added.
  • http/tests/xmlhttprequest/onloadend-event-after-load-expected.txt: Added.
  • http/tests/xmlhttprequest/onloadend-event-after-load.html: Added.
  • http/tests/xmlhttprequest/onloadend-event-after-sync-requests-expected.txt: Added.
  • http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html: Added.
  • http/tests/xmlhttprequest/upload-onloadend-event-after-abort-expected.txt: Added.
  • http/tests/xmlhttprequest/upload-onloadend-event-after-abort.html: Added.
  • http/tests/xmlhttprequest/upload-onloadend-event-after-load-expected.txt: Added.
  • http/tests/xmlhttprequest/upload-onloadend-event-after-load.html: Added.
  • http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests-expected.txt: Added.
  • http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html: Added.
  • http/tests/xmlhttprequest/xmlhttprequest-sync-no-progress-events-expected.txt:
File:
1 edited

Legend:

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

    r95901 r103502  
    8282}
    8383
     84void XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd(PassRefPtr<Event> event)
     85{
     86    ASSERT(event->type() == eventNames().loadEvent || event->type() == eventNames().abortEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().timeoutEvent);
     87
     88    dispatchEvent(event);
     89    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
     90}
     91
    8492void XMLHttpRequestProgressEventThrottle::flushProgressEvent()
    8593{
Note: See TracChangeset for help on using the changeset viewer.