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

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

Issue 348853009: Refactor mixed content checks against the top frame into MixedContentChecker. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WSS. Created 6 years, 5 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 | Annotate | Revision Log
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 130
131 bool NewWebSocketChannelImpl::connect(const KURL& url, const String& protocol) 131 bool NewWebSocketChannelImpl::connect(const KURL& url, const String& protocol)
132 { 132 {
133 WTF_LOG(Network, "NewWebSocketChannelImpl %p connect()", this); 133 WTF_LOG(Network, "NewWebSocketChannelImpl %p connect()", this);
134 if (!m_handle) 134 if (!m_handle)
135 return false; 135 return false;
136 136
137 if (executionContext()->isDocument() && document()->frame()) { 137 if (executionContext()->isDocument() && document()->frame()) {
138 if (!document()->frame()->loader().mixedContentChecker()->canConnectInse cureWebSocket(document()->securityOrigin(), url)) 138 if (!document()->frame()->loader().mixedContentChecker()->canConnectInse cureWebSocket(document()->securityOrigin(), url))
139 return false; 139 return false;
140 Frame* top = document()->frame()->tree().top();
141 if (top != document()->frame() && !toLocalFrame(top)->loader().mixedCont entChecker()->canConnectInsecureWebSocket(toLocalFrame(top)->document()->securit yOrigin(), url))
142 return false;
143 } 140 }
144 if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url)) { 141 if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url)) {
145 String message = "Connecting to a non-secure WebSocket server from a sec ure origin is deprecated."; 142 String message = "Connecting to a non-secure WebSocket server from a sec ure origin is deprecated.";
146 document()->addConsoleMessage(JSMessageSource, WarningMessageLevel, mess age); 143 document()->addConsoleMessage(JSMessageSource, WarningMessageLevel, mess age);
147 } 144 }
148 145
149 m_url = url; 146 m_url = url;
150 Vector<String> protocols; 147 Vector<String> protocols;
151 // Avoid placing an empty token in the Vector when the protocol string is 148 // Avoid placing an empty token in the Vector when the protocol string is
152 // empty. 149 // empty.
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 } 559 }
563 560
564 void NewWebSocketChannelImpl::trace(Visitor* visitor) 561 void NewWebSocketChannelImpl::trace(Visitor* visitor)
565 { 562 {
566 visitor->trace(m_blobLoader); 563 visitor->trace(m_blobLoader);
567 visitor->trace(m_client); 564 visitor->trace(m_client);
568 WebSocketChannel::trace(visitor); 565 WebSocketChannel::trace(visitor);
569 } 566 }
570 567
571 } // namespace WebCore 568 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698