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

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: 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() ||
hta - Chromium 2016/10/25 13:51:01 Having to call back my LGTM: You have to throw a d
foolip 2016/10/27 13:32:41 exceptionState.throwDOMException(SyntaxError, "'"
hta - Chromium 2016/11/08 12:12:30 :-) on the error generating problem - typical "syn
foolip 2016/11/08 15:39:07 Nope, that's still considered valid.
310 !(url.protocolIs("turn") || url.protocolIs("turns") || 310 !(url.protocolIs("turn") || url.protocolIs("turns") ||
311 url.protocolIs("stun"))) { 311 url.protocolIs("stun"))) {
312 exceptionState.throwTypeError("Malformed URL"); 312 exceptionState.throwDOMException(
313 SyntaxError,
314 "Unsupported URL \"" + urlString +
315 "\". URL scheme must be \"stun\", \"turn\" or \"turns\".");
hta - Chromium 2016/10/25 13:43:43 Hyper-nit: Should one use a StringBuilder instead
foolip 2016/10/27 13:32:41 Some places use String::format(), and a bunch use
313 return WebRTCConfiguration(); 316 return WebRTCConfiguration();
314 } 317 }
315 iceServers.append(WebRTCIceServer{url, username, credential}); 318 iceServers.append(WebRTCIceServer{url, username, credential});
316 } 319 }
317 } 320 }
318 webConfiguration.iceServers = iceServers; 321 webConfiguration.iceServers = iceServers;
319 } 322 }
320 323
321 if (configuration.hasCertificates()) { 324 if (configuration.hasCertificates()) {
322 const HeapVector<Member<RTCCertificate>>& certificates = 325 const HeapVector<Member<RTCCertificate>>& certificates =
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 DEFINE_TRACE(RTCPeerConnection) { 1468 DEFINE_TRACE(RTCPeerConnection) {
1466 visitor->trace(m_localStreams); 1469 visitor->trace(m_localStreams);
1467 visitor->trace(m_remoteStreams); 1470 visitor->trace(m_remoteStreams);
1468 visitor->trace(m_dispatchScheduledEventRunner); 1471 visitor->trace(m_dispatchScheduledEventRunner);
1469 visitor->trace(m_scheduledEvents); 1472 visitor->trace(m_scheduledEvents);
1470 EventTargetWithInlineData::trace(visitor); 1473 EventTargetWithInlineData::trace(visitor);
1471 ActiveDOMObject::trace(visitor); 1474 ActiveDOMObject::trace(visitor);
1472 } 1475 }
1473 1476
1474 } // namespace blink 1477 } // 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