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

Unified Diff: Source/modules/websockets/MainThreadWebSocketChannel.cpp

Issue 351163002: Prevent sandboxed iframes from bypassing WebSocket mixed content checks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/websockets/MainThreadWebSocketChannel.cpp
diff --git a/Source/modules/websockets/MainThreadWebSocketChannel.cpp b/Source/modules/websockets/MainThreadWebSocketChannel.cpp
index 2d2b76a658776388112c4ae178c44a02964160df..ed7adbdfb02a9d6de2518971728ff3db4aca3c4c 100644
--- a/Source/modules/websockets/MainThreadWebSocketChannel.cpp
+++ b/Source/modules/websockets/MainThreadWebSocketChannel.cpp
@@ -97,6 +97,9 @@ bool MainThreadWebSocketChannel::connect(const KURL& url, const String& protocol
if (m_document->frame() && !m_document->frame()->loader().mixedContentChecker()->canConnectInsecureWebSocket(m_document->securityOrigin(), url))
return false;
+ Frame* top = m_document->frame()->tree().top();
+ if (top != m_document->frame() && !toLocalFrame(top)->loader().mixedContentChecker()->canConnectInsecureWebSocket(toLocalFrame(top)->document()->securityOrigin(), url))
+ return false;
if (MixedContentChecker::isMixedContent(m_document->securityOrigin(), url)) {
String message = "Connecting to a non-secure WebSocket server from a secure origin is deprecated.";
m_document->addConsoleMessage(JSMessageSource, WarningMessageLevel, message);

Powered by Google App Engine
This is Rietveld 408576698