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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 current_url_ = response.Url(); | 247 current_url_ = response.Url(); |
248 event_stream_origin_ = SecurityOrigin::Create(response.Url())->ToString(); | 248 event_stream_origin_ = SecurityOrigin::Create(response.Url())->ToString(); |
249 int status_code = response.HttpStatusCode(); | 249 int status_code = response.HttpStatusCode(); |
250 bool mime_type_is_valid = response.MimeType() == "text/event-stream"; | 250 bool mime_type_is_valid = response.MimeType() == "text/event-stream"; |
251 bool response_is_valid = status_code == 200 && mime_type_is_valid; | 251 bool response_is_valid = status_code == 200 && mime_type_is_valid; |
252 if (response_is_valid) { | 252 if (response_is_valid) { |
253 const String& charset = response.TextEncodingName(); | 253 const String& charset = response.TextEncodingName(); |
254 // If we have a charset, the only allowed value is UTF-8 (case-insensitive). | 254 // If we have a charset, the only allowed value is UTF-8 (case-insensitive). |
255 response_is_valid = | 255 response_is_valid = |
256 charset.IsEmpty() || EqualIgnoringCase(charset, "UTF-8"); | 256 charset.IsEmpty() || DeprecatedEqualIgnoringCase(charset, "UTF-8"); |
257 if (!response_is_valid) { | 257 if (!response_is_valid) { |
258 StringBuilder message; | 258 StringBuilder message; |
259 message.Append("EventSource's response has a charset (\""); | 259 message.Append("EventSource's response has a charset (\""); |
260 message.Append(charset); | 260 message.Append(charset); |
261 message.Append("\") that is not UTF-8. Aborting the connection."); | 261 message.Append("\") that is not UTF-8. Aborting the connection."); |
262 // FIXME: We are missing the source line. | 262 // FIXME: We are missing the source line. |
263 GetExecutionContext()->AddConsoleMessage(ConsoleMessage::Create( | 263 GetExecutionContext()->AddConsoleMessage(ConsoleMessage::Create( |
264 kJSMessageSource, kErrorMessageLevel, message.ToString())); | 264 kJSMessageSource, kErrorMessageLevel, message.ToString())); |
265 } | 265 } |
266 } else { | 266 } else { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 DEFINE_TRACE(EventSource) { | 377 DEFINE_TRACE(EventSource) { |
378 visitor->Trace(parser_); | 378 visitor->Trace(parser_); |
379 visitor->Trace(loader_); | 379 visitor->Trace(loader_); |
380 EventTargetWithInlineData::Trace(visitor); | 380 EventTargetWithInlineData::Trace(visitor); |
381 ContextLifecycleObserver::Trace(visitor); | 381 ContextLifecycleObserver::Trace(visitor); |
382 EventSourceParser::Client::Trace(visitor); | 382 EventSourceParser::Client::Trace(visitor); |
383 } | 383 } |
384 | 384 |
385 } // namespace blink | 385 } // namespace blink |
OLD | NEW |