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

Side by Side Diff: Source/modules/websockets/DocumentWebSocketChannel.cpp

Issue 842783002: Mixed Content: Add a static check for WebSockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@lax
Patch Set: Rebase. Created 5 years, 11 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ASSERT(!m_blobLoader); 130 ASSERT(!m_blobLoader);
131 } 131 }
132 132
133 bool DocumentWebSocketChannel::connect(const KURL& url, const String& protocol) 133 bool DocumentWebSocketChannel::connect(const KURL& url, const String& protocol)
134 { 134 {
135 WTF_LOG(Network, "DocumentWebSocketChannel %p connect()", this); 135 WTF_LOG(Network, "DocumentWebSocketChannel %p connect()", this);
136 if (!m_handle) 136 if (!m_handle)
137 return false; 137 return false;
138 138
139 if (executionContext()->isDocument() && document()->frame()) { 139 if (executionContext()->isDocument() && document()->frame()) {
140 if (!document()->frame()->loader().mixedContentChecker()->canConnectInse cureWebSocket(document()->securityOrigin(), url)) 140 if (MixedContentChecker::shouldBlockConnection(document()->frame(), url) )
141 return false; 141 return false;
142 } 142 }
143 if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url)) { 143 if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url)) {
144 String message = "Connecting to a non-secure WebSocket server from a sec ure origin is deprecated."; 144 String message = "Connecting to a non-secure WebSocket server from a sec ure origin is deprecated.";
145 document()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Wa rningMessageLevel, message)); 145 document()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Wa rningMessageLevel, message));
146 } 146 }
147 147
148 m_url = url; 148 m_url = url;
149 Vector<String> protocols; 149 Vector<String> protocols;
150 // Avoid placing an empty token in the Vector when the protocol string is 150 // Avoid placing an empty token in the Vector when the protocol string is
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 589
590 void DocumentWebSocketChannel::trace(Visitor* visitor) 590 void DocumentWebSocketChannel::trace(Visitor* visitor)
591 { 591 {
592 visitor->trace(m_blobLoader); 592 visitor->trace(m_blobLoader);
593 visitor->trace(m_client); 593 visitor->trace(m_client);
594 WebSocketChannel::trace(visitor); 594 WebSocketChannel::trace(visitor);
595 ContextLifecycleObserver::trace(visitor); 595 ContextLifecycleObserver::trace(visitor);
596 } 596 }
597 597
598 } // namespace blink 598 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698