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

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

Issue 908483002: Fix to respect --explicitly-allowed-ports command line option (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | Source/platform/weborigin/KnownPorts.h » ('j') | public/platform/Platform.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | Source/platform/weborigin/KnownPorts.h » ('j') | public/platform/Platform.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698