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

Side by Side 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, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } else { 299 } else {
300 exceptionState.throwTypeError("Malformed RTCIceServer"); 300 exceptionState.throwTypeError("Malformed RTCIceServer");
301 return WebRTCConfiguration(); 301 return WebRTCConfiguration();
302 } 302 }
303 303
304 String username = iceServer.username(); 304 String username = iceServer.username();
305 String credential = iceServer.credential(); 305 String credential = iceServer.credential();
306 306
307 for (const String& urlString : urlStrings) { 307 for (const String& urlString : urlStrings) {
308 KURL url(KURL(), urlString); 308 KURL url(KURL(), urlString);
309 if (!url.isValid() || 309 if (!url.isValid()) {
310 !(url.protocolIs("turn") || url.protocolIs("turns") || 310 exceptionState.throwDOMException(
311 SyntaxError, "'" + urlString + "' is not a valid URL.");
312 return WebRTCConfiguration();
313 }
314 if (!(url.protocolIs("turn") || url.protocolIs("turns") ||
311 url.protocolIs("stun"))) { 315 url.protocolIs("stun"))) {
312 exceptionState.throwTypeError("Malformed URL"); 316 exceptionState.throwDOMException(
317 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
318 "' is not one of the supported URL schemes "
319 "'stun', 'turn' or 'turns'.");
313 return WebRTCConfiguration(); 320 return WebRTCConfiguration();
314 } 321 }
315 iceServers.append(WebRTCIceServer{url, username, credential}); 322 iceServers.append(WebRTCIceServer{url, username, credential});
316 } 323 }
317 } 324 }
318 webConfiguration.iceServers = iceServers; 325 webConfiguration.iceServers = iceServers;
319 } 326 }
320 327
321 if (configuration.hasCertificates()) { 328 if (configuration.hasCertificates()) {
322 const HeapVector<Member<RTCCertificate>>& certificates = 329 const HeapVector<Member<RTCCertificate>>& certificates =
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 DEFINE_TRACE(RTCPeerConnection) { 1472 DEFINE_TRACE(RTCPeerConnection) {
1466 visitor->trace(m_localStreams); 1473 visitor->trace(m_localStreams);
1467 visitor->trace(m_remoteStreams); 1474 visitor->trace(m_remoteStreams);
1468 visitor->trace(m_dispatchScheduledEventRunner); 1475 visitor->trace(m_dispatchScheduledEventRunner);
1469 visitor->trace(m_scheduledEvents); 1476 visitor->trace(m_scheduledEvents);
1470 EventTargetWithInlineData::trace(visitor); 1477 EventTargetWithInlineData::trace(visitor);
1471 ActiveDOMObject::trace(visitor); 1478 ActiveDOMObject::trace(visitor);
1472 } 1479 }
1473 1480
1474 } // namespace blink 1481 } // namespace blink
OLDNEW
« 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