- Revision
- 154004
- Author
- [email protected]
- Date
- 2013-08-13 09:16:04 -0700 (Tue, 13 Aug 2013)
Log Message
On request error, always fire events on the XMLHttpRequestUpload before the XMLHttpRequest
https://bugs.webkit.org/show_bug.cgi?id=119714
Reviewed by Alexey Proskuryakov.
Source/WebCore:
On request error, fire events on the XMLHttpRequestUpload object before the XMLHttpRequest
object as per the latest specification:
http://xhr.spec.whatwg.org/#request-error
This specification change was made in Sept 2010:
http://dev.w3.org/cvsweb/2006/webapi/XMLHttpRequest-2/Overview.src.html.diff?r1=1.138;r2=1.139;f=h
It addresses the following comment:
http://lists.w3.org/Archives/Public/public-webapps/2010JulSep/0777.html
IE10 and since recently Blink behave according to specification but WebKit was firing the
events on the XMLHttpRequest object BEFORE the XMLHttpRequestUpload object in case of
'network error' or 'abort error'. WebKit was however behaving according to specification
in case of 'timeout error', which was inconsistent.
Test: http/tests/xmlhttprequest/upload-request-error-event-order.html
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::networkError):
(WebCore::XMLHttpRequest::abortError):
LayoutTests:
Add a layout test to validate the order in which the events are fired in case
of a xhr request error. Also update an existing test which was relying on the
outdated firing order.
* http/tests/xmlhttprequest/simple-cross-origin-progress-events-expected.txt:
* http/tests/xmlhttprequest/simple-cross-origin-progress-events.html:
* http/tests/xmlhttprequest/upload-request-error-event-order-expected.txt: Added.
* http/tests/xmlhttprequest/upload-request-error-event-order.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (154003 => 154004)
--- trunk/LayoutTests/ChangeLog 2013-08-13 16:14:42 UTC (rev 154003)
+++ trunk/LayoutTests/ChangeLog 2013-08-13 16:16:04 UTC (rev 154004)
@@ -1,3 +1,19 @@
+2013-08-13 Christophe Dumez <[email protected]>
+
+ On request error, always fire events on the XMLHttpRequestUpload before the XMLHttpRequest
+ https://bugs.webkit.org/show_bug.cgi?id=119714
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add a layout test to validate the order in which the events are fired in case
+ of a xhr request error. Also update an existing test which was relying on the
+ outdated firing order.
+
+ * http/tests/xmlhttprequest/simple-cross-origin-progress-events-expected.txt:
+ * http/tests/xmlhttprequest/simple-cross-origin-progress-events.html:
+ * http/tests/xmlhttprequest/upload-request-error-event-order-expected.txt: Added.
+ * http/tests/xmlhttprequest/upload-request-error-event-order.html: Added.
+
2013-08-13 Gabor Abraham <[email protected]>
[Qt] Unreviewed gardening. Rebase tests after r153901 and r153915. Skip failing tests.
Modified: trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events-expected.txt (154003 => 154004)
--- trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events-expected.txt 2013-08-13 16:14:42 UTC (rev 154003)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events-expected.txt 2013-08-13 16:16:04 UTC (rev 154004)
@@ -13,7 +13,7 @@
Test 3: The URL is not allowed for cross-origin requests and at least one upload event is listened for before doing the send.
upload.onloadstart
+upload.onerror (expected)
onerror (expected)
Response length: 0
-upload.onerror (expected)
Modified: trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events.html (154003 => 154004)
--- trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events.html 2013-08-13 16:14:42 UTC (rev 154003)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events.html 2013-08-13 16:16:04 UTC (rev 154004)
@@ -103,12 +103,12 @@
xhr.upload._onload_ = function() { log("FAIL: upload.onload") }
xhr.upload._onerror_ = function() {
log("upload.onerror (expected)")
- if (window.testRunner)
- testRunner.notifyDone();
}
xhr._onerror_ = function() {
log("onerror (expected)");
log("Response length: " + xhr.responseText.length);
+ if (window.testRunner)
+ testRunner.notifyDone();
}
xhr._onload_ = function() {
log("onload");
Added: trunk/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order-expected.txt (0 => 154004)
--- trunk/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order-expected.txt 2013-08-13 16:16:04 UTC (rev 154004)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cross-site-progress-events.cgi. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
+Test to validate the order in which the events are fired in case of a request error.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS actualOrder is "rsdone,upload.onerror,upload.onloadend,onerror,onloadend,"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html (0 => 154004)
--- trunk/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html 2013-08-13 16:16:04 UTC (rev 154004)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="help" href=""
+<script src=""
+</head>
+<body>
+<script>
+description("Test to validate the order in which the events are fired in case of a request error.");
+window.jsTestIsAsync = true;
+
+expectedOrder = "rsdone,upload.onerror,upload.onloadend,onerror,onloadend,";
+actualOrder = "";
+
+var xhr = new XMLHttpRequest();
+xhr.open("POST", "http://localhost:8000/xmlhttprequest/resources/cross-site-progress-events.cgi", true);
+xhr.setRequestHeader("Content-Type", "text/plain");
+
+xhr._onreadystatechange_ = function () {
+ if (xhr.readyState == XMLHttpRequest.DONE) {
+ actualOrder += "rsdone,";
+ }
+};
+xhr.upload._onerror_ = function (evt) {
+ actualOrder += "upload.onerror,";
+};
+xhr.upload._onloadend_ = function () {
+ actualOrder += "upload.onloadend,";
+};
+xhr._onerror_ = function (evt) {
+ actualOrder += "onerror,";
+};
+xhr._onloadend_ = function () {
+ actualOrder += "onloadend,";
+ shouldBeEqualToString('actualOrder', '' + expectedOrder);
+ finishJSTest();
+};
+
+xhr.send("test");
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (154003 => 154004)
--- trunk/Source/WebCore/ChangeLog 2013-08-13 16:14:42 UTC (rev 154003)
+++ trunk/Source/WebCore/ChangeLog 2013-08-13 16:16:04 UTC (rev 154004)
@@ -1,5 +1,33 @@
2013-08-13 Christophe Dumez <[email protected]>
+ On request error, always fire events on the XMLHttpRequestUpload before the XMLHttpRequest
+ https://bugs.webkit.org/show_bug.cgi?id=119714
+
+ Reviewed by Alexey Proskuryakov.
+
+ On request error, fire events on the XMLHttpRequestUpload object before the XMLHttpRequest
+ object as per the latest specification:
+ http://xhr.spec.whatwg.org/#request-error
+
+ This specification change was made in Sept 2010:
+ http://dev.w3.org/cvsweb/2006/webapi/XMLHttpRequest-2/Overview.src.html.diff?r1=1.138;r2=1.139;f=h
+
+ It addresses the following comment:
+ http://lists.w3.org/Archives/Public/public-webapps/2010JulSep/0777.html
+
+ IE10 and since recently Blink behave according to specification but WebKit was firing the
+ events on the XMLHttpRequest object BEFORE the XMLHttpRequestUpload object in case of
+ 'network error' or 'abort error'. WebKit was however behaving according to specification
+ in case of 'timeout error', which was inconsistent.
+
+ Test: http/tests/xmlhttprequest/upload-request-error-event-order.html
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::networkError):
+ (WebCore::XMLHttpRequest::abortError):
+
+2013-08-13 Christophe Dumez <[email protected]>
+
Simplify RadioNodeList's anonymous indexed getter
https://bugs.webkit.org/show_bug.cgi?id=119725
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (154003 => 154004)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2013-08-13 16:14:42 UTC (rev 154003)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2013-08-13 16:16:04 UTC (rev 154004)
@@ -911,24 +911,24 @@
void XMLHttpRequest::networkError()
{
genericError();
- m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent));
if (!m_uploadComplete) {
m_uploadComplete = true;
if (m_upload && m_uploadEventsAllowed)
m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent));
}
+ m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent));
internalAbort();
}
void XMLHttpRequest::abortError()
{
genericError();
- m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
if (!m_uploadComplete) {
m_uploadComplete = true;
if (m_upload && m_uploadEventsAllowed)
m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
}
+ m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
}
void XMLHttpRequest::dropProtection()