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

Unified Diff: Source/modules/websockets/NewWebSocketChannelImpl.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
« no previous file with comments | « Source/modules/websockets/MainThreadWebSocketChannel.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/NewWebSocketChannelImpl.cpp
diff --git a/Source/modules/websockets/NewWebSocketChannelImpl.cpp b/Source/modules/websockets/NewWebSocketChannelImpl.cpp
index d081154a8bfc51b23d66775cdf3a3bfb8d48640a..a03e4b03da72ad1be0d6c01a38b8b19ba90a457c 100644
--- a/Source/modules/websockets/NewWebSocketChannelImpl.cpp
+++ b/Source/modules/websockets/NewWebSocketChannelImpl.cpp
@@ -134,8 +134,13 @@ bool NewWebSocketChannelImpl::connect(const KURL& url, const String& protocol)
if (!m_handle)
return false;
- if (executionContext()->isDocument() && document()->frame() && !document()->frame()->loader().mixedContentChecker()->canConnectInsecureWebSocket(document()->securityOrigin(), url))
- return false;
+ if (executionContext()->isDocument() && document()->frame()) {
+ if (!document()->frame()->loader().mixedContentChecker()->canConnectInsecureWebSocket(document()->securityOrigin(), url))
+ return false;
+ Frame* top = document()->frame()->tree().top();
+ if (top != document()->frame() && !toLocalFrame(top)->loader().mixedContentChecker()->canConnectInsecureWebSocket(toLocalFrame(top)->document()->securityOrigin(), url))
+ return false;
+ }
if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url)) {
String message = "Connecting to a non-secure WebSocket server from a secure origin is deprecated.";
document()->addConsoleMessage(JSMessageSource, WarningMessageLevel, message);
« no previous file with comments | « Source/modules/websockets/MainThreadWebSocketChannel.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698