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

Side by Side Diff: Source/modules/websockets/NewWebSocketChannelImpl.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "modules/websockets/NewWebSocketChannelImpl.h" 32 #include "modules/websockets/NewWebSocketChannelImpl.h"
33 33
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/ExecutionContext.h" 35 #include "core/dom/ExecutionContext.h"
36 #include "core/fileapi/FileReaderLoader.h" 36 #include "core/fileapi/FileReaderLoader.h"
37 #include "core/fileapi/FileReaderLoaderClient.h" 37 #include "core/fileapi/FileReaderLoaderClient.h"
38 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
39 #include "core/inspector/ConsoleMessage.h"
39 #include "core/inspector/InspectorInstrumentation.h" 40 #include "core/inspector/InspectorInstrumentation.h"
40 #include "core/inspector/InspectorTraceEvents.h" 41 #include "core/inspector/InspectorTraceEvents.h"
41 #include "core/loader/FrameLoader.h" 42 #include "core/loader/FrameLoader.h"
42 #include "core/loader/FrameLoaderClient.h" 43 #include "core/loader/FrameLoaderClient.h"
43 #include "core/loader/MixedContentChecker.h" 44 #include "core/loader/MixedContentChecker.h"
44 #include "core/loader/UniqueIdentifier.h" 45 #include "core/loader/UniqueIdentifier.h"
45 #include "modules/websockets/WebSocketChannelClient.h" 46 #include "modules/websockets/WebSocketChannelClient.h"
46 #include "modules/websockets/WebSocketFrame.h" 47 #include "modules/websockets/WebSocketFrame.h"
47 #include "platform/Logging.h" 48 #include "platform/Logging.h"
48 #include "platform/network/WebSocketHandshakeRequest.h" 49 #include "platform/network/WebSocketHandshakeRequest.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 WTF_LOG(Network, "NewWebSocketChannelImpl %p connect()", this); 134 WTF_LOG(Network, "NewWebSocketChannelImpl %p connect()", this);
134 if (!m_handle) 135 if (!m_handle)
135 return false; 136 return false;
136 137
137 if (executionContext()->isDocument() && document()->frame()) { 138 if (executionContext()->isDocument() && document()->frame()) {
138 if (!document()->frame()->loader().mixedContentChecker()->canConnectInse cureWebSocket(document()->securityOrigin(), url)) 139 if (!document()->frame()->loader().mixedContentChecker()->canConnectInse cureWebSocket(document()->securityOrigin(), url))
139 return false; 140 return false;
140 } 141 }
141 if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url)) { 142 if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url)) {
142 String message = "Connecting to a non-secure WebSocket server from a sec ure origin is deprecated."; 143 String message = "Connecting to a non-secure WebSocket server from a sec ure origin is deprecated.";
143 document()->addConsoleMessage(JSMessageSource, WarningMessageLevel, mess age); 144 document()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Wa rningMessageLevel, message));
144 } 145 }
145 146
146 m_url = url; 147 m_url = url;
147 Vector<String> protocols; 148 Vector<String> protocols;
148 // Avoid placing an empty token in the Vector when the protocol string is 149 // Avoid placing an empty token in the Vector when the protocol string is
149 // empty. 150 // empty.
150 if (!protocol.isEmpty()) { 151 if (!protocol.isEmpty()) {
151 // Since protocol is already verified and escaped, we can simply split 152 // Since protocol is already verified and escaped, we can simply split
152 // it. 153 // it.
153 protocol.split(", ", true, protocols); 154 protocol.split(", ", true, protocols);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 237 }
237 238
238 void NewWebSocketChannelImpl::fail(const String& reason, MessageLevel level, con st String& sourceURL, unsigned lineNumber) 239 void NewWebSocketChannelImpl::fail(const String& reason, MessageLevel level, con st String& sourceURL, unsigned lineNumber)
239 { 240 {
240 WTF_LOG(Network, "NewWebSocketChannelImpl %p fail(%s)", this, reason.utf8(). data()); 241 WTF_LOG(Network, "NewWebSocketChannelImpl %p fail(%s)", this, reason.utf8(). data());
241 // m_handle and m_client can be null here. 242 // m_handle and m_client can be null here.
242 243
243 if (m_identifier) 244 if (m_identifier)
244 InspectorInstrumentation::didReceiveWebSocketFrameError(document(), m_id entifier, reason); 245 InspectorInstrumentation::didReceiveWebSocketFrameError(document(), m_id entifier, reason);
245 const String message = "WebSocket connection to '" + m_url.elidedString() + "' failed: " + reason; 246 const String message = "WebSocket connection to '" + m_url.elidedString() + "' failed: " + reason;
246 executionContext()->addConsoleMessage(JSMessageSource, level, message, sourc eURL, lineNumber); 247 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource , level, message, sourceURL, lineNumber));
247 248
248 if (m_client) 249 if (m_client)
249 m_client->didReceiveMessageError(); 250 m_client->didReceiveMessageError();
250 // |reason| is only for logging and should not be provided for scripts, 251 // |reason| is only for logging and should not be provided for scripts,
251 // hence close reason must be empty. 252 // hence close reason must be empty.
252 handleDidClose(false, CloseEventCodeAbnormalClosure, String()); 253 handleDidClose(false, CloseEventCodeAbnormalClosure, String());
253 // handleDidClose may delete this object. 254 // handleDidClose may delete this object.
254 } 255 }
255 256
256 void NewWebSocketChannelImpl::disconnect() 257 void NewWebSocketChannelImpl::disconnect()
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 } 558 }
558 559
559 void NewWebSocketChannelImpl::trace(Visitor* visitor) 560 void NewWebSocketChannelImpl::trace(Visitor* visitor)
560 { 561 {
561 visitor->trace(m_blobLoader); 562 visitor->trace(m_blobLoader);
562 visitor->trace(m_client); 563 visitor->trace(m_client);
563 WebSocketChannel::trace(visitor); 564 WebSocketChannel::trace(visitor);
564 } 565 }
565 566
566 } // namespace blink 567 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/websockets/MainThreadWebSocketChannel.cpp ('k') | Source/web/ServiceWorkerGlobalScopeProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698