Index: Source/modules/websockets/DOMWebSocket.cpp |
diff --git a/Source/modules/websockets/DOMWebSocket.cpp b/Source/modules/websockets/DOMWebSocket.cpp |
index ccf4d7f38900365194522e4dd85763a6fac176e1..5e21ae9c4b85c080767518362fc8cd8adc65d70c 100644 |
--- a/Source/modules/websockets/DOMWebSocket.cpp |
+++ b/Source/modules/websockets/DOMWebSocket.cpp |
@@ -53,7 +53,6 @@ |
#include "platform/Logging.h" |
#include "platform/blob/BlobData.h" |
#include "platform/heap/Handle.h" |
-#include "platform/weborigin/KnownPorts.h" |
#include "platform/weborigin/SecurityOrigin.h" |
#include "public/platform/Platform.h" |
#include "wtf/Assertions.h" |
@@ -305,10 +304,13 @@ void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E |
exceptionState.throwDOMException(SyntaxError, "The URL contains a fragment identifier ('" + m_url.fragmentIdentifier() + "'). Fragment identifiers are not allowed in WebSocket URLs."); |
return; |
} |
- if (!portAllowed(m_url)) { |
- m_state = CLOSED; |
- exceptionState.throwSecurityError("The port " + String::number(m_url.port()) + " is not allowed."); |
- return; |
+ |
+ if (m_url.hasPort()) { |
+ if (!Platform::current()->portAllowed(m_url.port())) { |
+ m_state = CLOSED; |
+ exceptionState.throwSecurityError("The port " + String::number(m_url.port()) + " is not allowed."); |
+ return; |
+ } |
} |
// FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved. |