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

Unified Diff: third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp

Issue 2448843003: Throw SyntaxError for non-turn/turns/stun URLs (Closed)
Patch Set: split valid and scheme checks Created 4 years, 2 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/imported/wpt/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt ('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/peerconnection/RTCPeerConnection.cpp
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
index 9e3ecb07b8b760b27ab25eb1813c7b6f7046b03d..0e627f0d90ee1c221789aed757dc78dab2b732ab 100644
--- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
+++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
@@ -306,10 +306,17 @@ WebRTCConfiguration parseConfiguration(ExecutionContext* context,
for (const String& urlString : urlStrings) {
KURL url(KURL(), urlString);
- if (!url.isValid() ||
- !(url.protocolIs("turn") || url.protocolIs("turns") ||
+ if (!url.isValid()) {
+ exceptionState.throwDOMException(
+ SyntaxError, "'" + urlString + "' is not a valid URL.");
+ return WebRTCConfiguration();
+ }
+ if (!(url.protocolIs("turn") || url.protocolIs("turns") ||
url.protocolIs("stun"))) {
- exceptionState.throwTypeError("Malformed URL");
+ exceptionState.throwDOMException(
+ SyntaxError, "'" + url.protocol() +
foolip 2016/10/27 13:34:38 This really isn't a SyntaxError, do we care? I don
hta - Chromium 2016/11/08 12:12:30 Neither do I :-) It's an illegal parameter, as lon
+ "' is not one of the supported URL schemes "
+ "'stun', 'turn' or 'turns'.");
return WebRTCConfiguration();
}
iceServers.append(WebRTCIceServer{url, username, credential});
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/wpt/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698