Code: void XMLHttpRequest::abortError()
 {
    genericError();
    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));
 }

Commit Message: Don't dispatch events when XHR is set to sync mode

Any of readystatechange, progress, abort, error, timeout and loadend
event are not specified to be dispatched in sync mode in the latest
spec. Just an exception corresponding to the failure is thrown.

Clean up for readability done in this CL
- factor out dispatchEventAndLoadEnd calling code
- make didTimeout() private
- give error handling methods more descriptive names
- set m_exceptionCode in failure type specific methods
-- Note that for didFailRedirectCheck, m_exceptionCode was not set
   in networkError(), but was set at the end of createRequest()

This CL is prep for fixing crbug.com/292422

BUG=292422

Review URL: https://chromiumcodereview.appspot.com/24225002

git-svn-id: svn://svn.chromium.org/blink/trunk@158046 bbb929c8-8fbe-4397-9dbb-9b2b20218538
CWE ID: CWE-399
void XMLHttpRequest::abortError()
void XMLHttpRequest::handleDidCancel()
 {
    m_exceptionCode = AbortError;

    handleDidFailGeneric();

    if (!m_async) {
        m_state = DONE;
        return;
     }
    changeState(DONE);

    dispatchEventAndLoadEnd(eventNames().abortEvent);
 }
