Index: Source/modules/websockets/WebSocket.cpp |
diff --git a/Source/modules/websockets/WebSocket.cpp b/Source/modules/websockets/WebSocket.cpp |
index 1d3cbfd39b479da182ae1c6ad5a82302917feef4..59a360c281c98b40e1181e0d09ef422b3dbaf0d3 100644 |
--- a/Source/modules/websockets/WebSocket.cpp |
+++ b/Source/modules/websockets/WebSocket.cpp |
@@ -301,11 +301,7 @@ void WebSocket::connect(const String& url, const Vector<String>& protocols, Exce |
exceptionState.throwDOMException(SyntaxError, "The URL's scheme must be either 'ws' or 'wss'. '" + m_url.protocol() + "' is not allowed."); |
return; |
} |
- if (MixedContentChecker::isMixedContent(executionContext()->securityOrigin(), m_url)) { |
- // FIXME: Throw an exception and close the connection. |
- String message = "Connecting to a non-secure WebSocket server from a secure origin is deprecated."; |
- executionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel, message); |
- } |
+ |
if (m_url.hasFragmentIdentifier()) { |
m_state = CLOSED; |
exceptionState.throwDOMException(SyntaxError, "The URL contains a fragment identifier ('" + m_url.fragmentIdentifier() + "'). Fragment identifiers are not allowed in WebSocket URLs."); |
@@ -354,7 +350,12 @@ void WebSocket::connect(const String& url, const Vector<String>& protocols, Exce |
if (!protocols.isEmpty()) |
protocolString = joinStrings(protocols, subProtocolSeperator()); |
- m_channel->connect(m_url, protocolString); |
+ if (!m_channel->connect(m_url, protocolString)) { |
+ m_state = CLOSED; |
+ exceptionState.throwSecurityError("An insecure WebSocket connection may not be initiated from a page loaded over HTTPS."); |
+ releaseChannel(); |
+ return; |
+ } |
} |
void WebSocket::handleSendResult(WebSocketChannel::SendResult result, ExceptionState& exceptionState, WebSocketSendType dataType) |