Onloadend event is not supported in XMLHttpRequest
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Dec 2011 08:55:04 +0000 (08:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Dec 2011 08:55:04 +0000 (08:55 +0000)
commite14fd890270118664011e84610d0da8e9956350e
treeaa99641255283019fce172b724cba98177842b19
parent18278a573d3041268b82f9e303879149b2859f0a
Onloadend event is not supported in XMLHttpRequest
https://bugs.webkit.org/show_bug.cgi?id=40952

Patch by Hans Muller <hmuller@adobe.com> 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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103502 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-abort-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-abort.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-error-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-error.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-load-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-load.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-sync-requests-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-abort-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-abort.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-load-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-load.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-progress-events-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h
Source/WebCore/xml/XMLHttpRequest.idl
Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp
Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h
Source/WebCore/xml/XMLHttpRequestUpload.cpp
Source/WebCore/xml/XMLHttpRequestUpload.h
Source/WebCore/xml/XMLHttpRequestUpload.idl