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

Side by Side Diff: Source/modules/websockets/MainThreadWebSocketChannel.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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 bool MainThreadWebSocketChannel::connect(const KURL& url, const String& protocol ) 92 bool MainThreadWebSocketChannel::connect(const KURL& url, const String& protocol )
93 { 93 {
94 WTF_LOG(Network, "MainThreadWebSocketChannel %p connect()", this); 94 WTF_LOG(Network, "MainThreadWebSocketChannel %p connect()", this);
95 ASSERT(!m_handle); 95 ASSERT(!m_handle);
96 ASSERT(!m_suspended); 96 ASSERT(!m_suspended);
97 97
98 if (m_document->frame() && !m_document->frame()->loader().mixedContentChecke r()->canConnectInsecureWebSocket(m_document->securityOrigin(), url)) 98 if (m_document->frame() && !m_document->frame()->loader().mixedContentChecke r()->canConnectInsecureWebSocket(m_document->securityOrigin(), url))
99 return false; 99 return false;
100 Frame* top = m_document->frame()->tree().top();
101 if (top != m_document->frame() && !toLocalFrame(top)->loader().mixedContentC hecker()->canConnectInsecureWebSocket(toLocalFrame(top)->document()->securityOri gin(), url))
102 return false;
103 if (MixedContentChecker::isMixedContent(m_document->securityOrigin(), url)) { 100 if (MixedContentChecker::isMixedContent(m_document->securityOrigin(), url)) {
Mike West 2014/06/30 12:24:37 This is here in case the user has flipped the abou
104 String message = "Connecting to a non-secure WebSocket server from a sec ure origin is deprecated."; 101 String message = "Connecting to a non-secure WebSocket server from a sec ure origin is deprecated.";
105 m_document->addConsoleMessage(JSMessageSource, WarningMessageLevel, mess age); 102 m_document->addConsoleMessage(JSMessageSource, WarningMessageLevel, mess age);
106 } 103 }
107 104
108 m_handshake = adoptPtrWillBeNoop(new WebSocketHandshake(url, protocol, m_doc ument)); 105 m_handshake = adoptPtrWillBeNoop(new WebSocketHandshake(url, protocol, m_doc ument));
109 m_handshake->reset(); 106 m_handshake->reset();
110 m_handshake->addExtensionProcessor(m_perMessageDeflate.createExtensionProces sor()); 107 m_handshake->addExtensionProcessor(m_perMessageDeflate.createExtensionProces sor());
111 m_handshake->addExtensionProcessor(m_deflateFramer.createExtensionProcessor( )); 108 m_handshake->addExtensionProcessor(m_deflateFramer.createExtensionProcessor( ));
112 if (m_identifier) { 109 if (m_identifier) {
113 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketCreate", "data", InspectorWebSocketCreateEvent::data(m_document, m_identi fier, url, protocol)); 110 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketCreate", "data", InspectorWebSocketCreateEvent::data(m_document, m_identi fier, url, protocol));
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 { 871 {
875 visitor->trace(m_document); 872 visitor->trace(m_document);
876 visitor->trace(m_client); 873 visitor->trace(m_client);
877 visitor->trace(m_handshake); 874 visitor->trace(m_handshake);
878 visitor->trace(m_handle); 875 visitor->trace(m_handle);
879 WebSocketChannel::trace(visitor); 876 WebSocketChannel::trace(visitor);
880 SocketStreamHandleClient::trace(visitor); 877 SocketStreamHandleClient::trace(visitor);
881 } 878 }
882 879
883 } // namespace WebCore 880 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698