| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. |
| 3 * Copyright (C) 2010 Apple Inc. All rights reserved. | 3 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. | 4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 const AtomicString& EventSource::interfaceName() const | 213 const AtomicString& EventSource::interfaceName() const |
| 214 { | 214 { |
| 215 return EventTargetNames::EventSource; | 215 return EventTargetNames::EventSource; |
| 216 } | 216 } |
| 217 | 217 |
| 218 ExecutionContext* EventSource::executionContext() const | 218 ExecutionContext* EventSource::executionContext() const |
| 219 { | 219 { |
| 220 return ActiveDOMObject::executionContext(); | 220 return ActiveDOMObject::executionContext(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& resp
onse) | 223 void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& resp
onse, PassOwnPtr<WebDataConsumerHandle> handle) |
| 224 { | 224 { |
| 225 ASSERT_UNUSED(handle, !handle); |
| 225 ASSERT(m_state == CONNECTING); | 226 ASSERT(m_state == CONNECTING); |
| 226 ASSERT(m_requestInFlight); | 227 ASSERT(m_requestInFlight); |
| 227 | 228 |
| 228 m_eventStreamOrigin = SecurityOrigin::create(response.url())->toString(); | 229 m_eventStreamOrigin = SecurityOrigin::create(response.url())->toString(); |
| 229 int statusCode = response.httpStatusCode(); | 230 int statusCode = response.httpStatusCode(); |
| 230 bool mimeTypeIsValid = response.mimeType() == "text/event-stream"; | 231 bool mimeTypeIsValid = response.mimeType() == "text/event-stream"; |
| 231 bool responseIsValid = statusCode == 200 && mimeTypeIsValid; | 232 bool responseIsValid = statusCode == 200 && mimeTypeIsValid; |
| 232 if (responseIsValid) { | 233 if (responseIsValid) { |
| 233 const String& charset = response.textEncodingName(); | 234 const String& charset = response.textEncodingName(); |
| 234 // If we have a charset, the only allowed value is UTF-8 (case-insensiti
ve). | 235 // If we have a charset, the only allowed value is UTF-8 (case-insensiti
ve). |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 432 |
| 432 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent() | 433 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent() |
| 433 { | 434 { |
| 434 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(); | 435 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(); |
| 435 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_
eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS
treamOrigin, m_lastEventId, 0, nullptr); | 436 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_
eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS
treamOrigin, m_lastEventId, 0, nullptr); |
| 436 m_data.clear(); | 437 m_data.clear(); |
| 437 return event.release(); | 438 return event.release(); |
| 438 } | 439 } |
| 439 | 440 |
| 440 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |