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

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

Issue 2362263003: Disable WebSockets API in suborigins (Closed)
Patch Set: Rebase on ToT Created 4 years, 3 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 | « third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-websocket.php ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
index 3072a54a4feac27db0e948bee34d9948b5f9240b..87ef6a1816b7e8a4f995f672c3a8c3f78c964702 100644
--- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
@@ -345,6 +345,12 @@ void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E
}
}
+ if (getExecutionContext()->getSecurityOrigin()->hasSuborigin()) {
+ m_state = kClosed;
+ exceptionState.throwSecurityError("Connecting to a WebSocket from a suborigin is not allowed.");
+ return;
+ }
+
String protocolString;
if (!protocols.isEmpty())
protocolString = joinStrings(protocols, subprotocolSeperator());
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-websocket.php ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698