Example #1
0
void EventSource::didFail(const ResourceError& error)
{
    ASSERT(m_state != CLOSED);

    if (error.isAccessControl()) {
        String message = makeString("EventSource cannot load ", error.failingURL().string(), ". ", error.localizedDescription());
        scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, message);

        abortConnectionAttempt();
        return;
    }

    ASSERT(m_requestInFlight);

    if (error.isCancellation())
        m_state = CLOSED;

    // FIXME: Why don't we need to clear data members here as in didFinishLoading?

    networkRequestEnded();
}