| Index: Source/modules/websockets/DOMWebSocket.cpp
|
| diff --git a/Source/modules/websockets/DOMWebSocket.cpp b/Source/modules/websockets/DOMWebSocket.cpp
|
| index a1784b50ef5a366ccdef37cb318f6d0844bea6c4..132daec0ffc22e2bd4ad40dfed3248dd602295d3 100644
|
| --- a/Source/modules/websockets/DOMWebSocket.cpp
|
| +++ b/Source/modules/websockets/DOMWebSocket.cpp
|
| @@ -38,6 +38,7 @@
|
| #include "core/dom/Document.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/dom/ExecutionContext.h"
|
| +#include "core/dom/SecurityContext.h"
|
| #include "core/events/MessageEvent.h"
|
| #include "core/fileapi/Blob.h"
|
| #include "core/frame/ConsoleTypes.h"
|
| @@ -271,9 +272,16 @@ DOMWebSocket* DOMWebSocket::create(ExecutionContext* context, const String& url,
|
|
|
| void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, ExceptionState& exceptionState)
|
| {
|
| +
|
| WTF_LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data());
|
| m_url = KURL(KURL(), url);
|
|
|
| + if (executionContext()->securityContext().insecureContentPolicy() == SecurityContext::InsecureContentUpgrade && m_url.protocol() == "ws") {
|
| + m_url.setProtocol("wss");
|
| + if (m_url.port() == 80)
|
| + m_url.setPort(443);
|
| + }
|
| +
|
| if (!m_url.isValid()) {
|
| m_state = CLOSED;
|
| exceptionState.throwDOMException(SyntaxError, "The URL '" + url + "' is invalid.");
|
|
|