Changeset 154004 in webkit


Ignore:
Timestamp:
Aug 13, 2013 9:16:04 AM (11 years ago)
Author:
Christophe Dumez
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.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r153999 r154004  
     12013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        On request error, always fire events on the XMLHttpRequestUpload before the XMLHttpRequest
     4        https://bugs.webkit.org/show_bug.cgi?id=119714
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Add a layout test to validate the order in which the events are fired in case
     9        of a xhr request error. Also update an existing test which was relying on the
     10        outdated firing order.
     11
     12        * http/tests/xmlhttprequest/simple-cross-origin-progress-events-expected.txt:
     13        * http/tests/xmlhttprequest/simple-cross-origin-progress-events.html:
     14        * http/tests/xmlhttprequest/upload-request-error-event-order-expected.txt: Added.
     15        * http/tests/xmlhttprequest/upload-request-error-event-order.html: Added.
     16
    1172013-08-13  Gabor Abraham  <abrhm@inf.u-szeged.hu>
    218
  • trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events-expected.txt

    r104803 r154004  
    1414Test 3: The URL is not allowed for cross-origin requests and at least one upload event is listened for before doing the send.
    1515upload.onloadstart
     16upload.onerror (expected)
    1617onerror (expected)
    1718Response length: 0
    18 upload.onerror (expected)
    1919
  • trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events.html

    r120167 r154004  
    104104    xhr.upload.onerror = function() {
    105105        log("upload.onerror (expected)")
    106         if (window.testRunner)
    107             testRunner.notifyDone();
    108106    }
    109107    xhr.onerror = function() {
    110108        log("onerror (expected)");
    111109        log("Response length: " + xhr.responseText.length);
     110        if (window.testRunner)
     111            testRunner.notifyDone();
    112112    }
    113113    xhr.onload = function() {
  • trunk/Source/WebCore/ChangeLog

    r154003 r154004  
     12013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        On request error, always fire events on the XMLHttpRequestUpload before the XMLHttpRequest
     4        https://bugs.webkit.org/show_bug.cgi?id=119714
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        On request error, fire events on the XMLHttpRequestUpload object before the XMLHttpRequest
     9        object as per the latest specification:
     10        http://xhr.spec.whatwg.org/#request-error
     11
     12        This specification change was made in Sept 2010:
     13        http://dev.w3.org/cvsweb/2006/webapi/XMLHttpRequest-2/Overview.src.html.diff?r1=1.138;r2=1.139;f=h
     14
     15        It addresses the following comment:
     16        http://lists.w3.org/Archives/Public/public-webapps/2010JulSep/0777.html
     17
     18        IE10 and since recently Blink behave according to specification but WebKit was firing the
     19        events on the XMLHttpRequest object BEFORE the XMLHttpRequestUpload object in case of
     20        'network error' or 'abort error'. WebKit was however behaving according to specification
     21        in case of 'timeout error', which was inconsistent.
     22
     23        Test: http/tests/xmlhttprequest/upload-request-error-event-order.html
     24
     25        * xml/XMLHttpRequest.cpp:
     26        (WebCore::XMLHttpRequest::networkError):
     27        (WebCore::XMLHttpRequest::abortError):
     28
    1292013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    230
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r153926 r154004  
    912912{
    913913    genericError();
    914     m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent));
    915914    if (!m_uploadComplete) {
    916915        m_uploadComplete = true;
     
    918917            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent));
    919918    }
     919    m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent));
    920920    internalAbort();
    921921}
     
    924924{
    925925    genericError();
    926     m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
    927926    if (!m_uploadComplete) {
    928927        m_uploadComplete = true;
     
    930929            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
    931930    }
     931    m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
    932932}
    933933
Note: See TracChangeset for help on using the changeset viewer.