Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: Source/core/page/EventSource.cpp

Issue 419203004: DevTools: wrapping arguments addConsoleMessage in ConsoleMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@wrap-not-all-console-args
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 28 matching lines...) Expand all
39 #include "bindings/core/v8/SerializedScriptValue.h" 39 #include "bindings/core/v8/SerializedScriptValue.h"
40 #include "core/dom/Document.h" 40 #include "core/dom/Document.h"
41 #include "core/dom/ExceptionCode.h" 41 #include "core/dom/ExceptionCode.h"
42 #include "core/dom/ExecutionContext.h" 42 #include "core/dom/ExecutionContext.h"
43 #include "core/events/Event.h" 43 #include "core/events/Event.h"
44 #include "core/events/MessageEvent.h" 44 #include "core/events/MessageEvent.h"
45 #include "core/frame/LocalDOMWindow.h" 45 #include "core/frame/LocalDOMWindow.h"
46 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
47 #include "core/frame/csp/ContentSecurityPolicy.h" 47 #include "core/frame/csp/ContentSecurityPolicy.h"
48 #include "core/html/parser/TextResourceDecoder.h" 48 #include "core/html/parser/TextResourceDecoder.h"
49 #include "core/inspector/ConsoleMessage.h"
49 #include "core/loader/ThreadableLoader.h" 50 #include "core/loader/ThreadableLoader.h"
50 #include "platform/network/ResourceError.h" 51 #include "platform/network/ResourceError.h"
51 #include "platform/network/ResourceRequest.h" 52 #include "platform/network/ResourceRequest.h"
52 #include "platform/network/ResourceResponse.h" 53 #include "platform/network/ResourceResponse.h"
53 #include "platform/weborigin/SecurityOrigin.h" 54 #include "platform/weborigin/SecurityOrigin.h"
54 #include "public/platform/WebURLRequest.h" 55 #include "public/platform/WebURLRequest.h"
55 #include "wtf/text/StringBuilder.h" 56 #include "wtf/text/StringBuilder.h"
56 57
57 namespace blink { 58 namespace blink {
58 59
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if (responseIsValid) { 234 if (responseIsValid) {
234 const String& charset = response.textEncodingName(); 235 const String& charset = response.textEncodingName();
235 // If we have a charset, the only allowed value is UTF-8 (case-insensiti ve). 236 // If we have a charset, the only allowed value is UTF-8 (case-insensiti ve).
236 responseIsValid = charset.isEmpty() || equalIgnoringCase(charset, "UTF-8 "); 237 responseIsValid = charset.isEmpty() || equalIgnoringCase(charset, "UTF-8 ");
237 if (!responseIsValid) { 238 if (!responseIsValid) {
238 StringBuilder message; 239 StringBuilder message;
239 message.appendLiteral("EventSource's response has a charset (\""); 240 message.appendLiteral("EventSource's response has a charset (\"");
240 message.append(charset); 241 message.append(charset);
241 message.appendLiteral("\") that is not UTF-8. Aborting the connectio n."); 242 message.appendLiteral("\") that is not UTF-8. Aborting the connectio n.");
242 // FIXME: We are missing the source line. 243 // FIXME: We are missing the source line.
243 executionContext()->addConsoleMessage(JSMessageSource, ErrorMessageL evel, message.toString()); 244 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message.toString()));
244 } 245 }
245 } else { 246 } else {
246 // To keep the signal-to-noise ratio low, we only log 200-response with an invalid MIME type. 247 // To keep the signal-to-noise ratio low, we only log 200-response with an invalid MIME type.
247 if (statusCode == 200 && !mimeTypeIsValid) { 248 if (statusCode == 200 && !mimeTypeIsValid) {
248 StringBuilder message; 249 StringBuilder message;
249 message.appendLiteral("EventSource's response has a MIME type (\""); 250 message.appendLiteral("EventSource's response has a MIME type (\"");
250 message.append(response.mimeType()); 251 message.append(response.mimeType());
251 message.appendLiteral("\") that is not \"text/event-stream\". Aborti ng the connection."); 252 message.appendLiteral("\") that is not \"text/event-stream\". Aborti ng the connection.");
252 // FIXME: We are missing the source line. 253 // FIXME: We are missing the source line.
253 executionContext()->addConsoleMessage(JSMessageSource, ErrorMessageL evel, message.toString()); 254 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message.toString()));
254 } 255 }
255 } 256 }
256 257
257 if (responseIsValid) { 258 if (responseIsValid) {
258 m_state = OPEN; 259 m_state = OPEN;
259 dispatchEvent(Event::create(EventTypeNames::open)); 260 dispatchEvent(Event::create(EventTypeNames::open));
260 } else { 261 } else {
261 m_loader->cancel(); 262 m_loader->cancel();
262 dispatchEvent(Event::create(EventTypeNames::error)); 263 dispatchEvent(Event::create(EventTypeNames::error));
263 } 264 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 ASSERT(m_requestInFlight); 296 ASSERT(m_requestInFlight);
296 297
297 if (error.isCancellation()) 298 if (error.isCancellation())
298 m_state = CLOSED; 299 m_state = CLOSED;
299 networkRequestEnded(); 300 networkRequestEnded();
300 } 301 }
301 302
302 void EventSource::didFailAccessControlCheck(const ResourceError& error) 303 void EventSource::didFailAccessControlCheck(const ResourceError& error)
303 { 304 {
304 String message = "EventSource cannot load " + error.failingURL() + ". " + er ror.localizedDescription(); 305 String message = "EventSource cannot load " + error.failingURL() + ". " + er ror.localizedDescription();
305 executionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, me ssage); 306 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource , ErrorMessageLevel, message));
306 307
307 abortConnectionAttempt(); 308 abortConnectionAttempt();
308 } 309 }
309 310
310 void EventSource::didFailRedirectCheck() 311 void EventSource::didFailRedirectCheck()
311 { 312 {
312 abortConnectionAttempt(); 313 abortConnectionAttempt();
313 } 314 }
314 315
315 void EventSource::abortConnectionAttempt() 316 void EventSource::abortConnectionAttempt()
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 433
433 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent() 434 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent()
434 { 435 {
435 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(); 436 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create();
436 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_ eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS treamOrigin, m_lastEventId, 0, nullptr); 437 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_ eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS treamOrigin, m_lastEventId, 0, nullptr);
437 m_data.clear(); 438 m_data.clear();
438 return event.release(); 439 return event.release();
439 } 440 }
440 441
441 } // namespace blink 442 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698