Index: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp |
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp |
index 5dcf61e6ea105d298fd09c0997c1561b7d54c7fb..636342bf630479f8f69059b775bc7e3351718e6a 100644 |
--- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp |
+++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp |
@@ -143,26 +143,17 @@ RTCConfiguration* RTCPeerConnection::parseConfiguration(const Dictionary& config |
} |
ArrayValue iceServers; |
- size_t numberOfServers = 0; |
- bool createIceServerArray = true; |
- if (DictionaryHelper::get(configuration, "iceServers", iceServers)) { |
- if (!iceServers.length(numberOfServers)) { |
- exceptionState.throwTypeError("Malformed RTCConfiguration"); |
- return 0; |
- } |
- } else { |
- v8::Local<v8::Value> iceServersValue; |
- // Failed to parse iceServers as ArrayValue, try it as a scalar. If |
- // iceServers is not specified (get returns false) or specified as |
- // "undefined", treat it as the special case which RTCIceServerArray |
- // will not be created. |
- bool ok = (!DictionaryHelper::get(configuration, "iceServers", iceServersValue) |
- || iceServersValue->IsUndefined()); |
- if (!ok) { |
- exceptionState.throwTypeError("Malformed RTCConfiguration"); |
- return 0; |
- } |
- createIceServerArray = false; |
+ bool ok = DictionaryHelper::get(configuration, "iceServers", iceServers); |
+ if (!ok || iceServers.isUndefinedOrNull()) { |
+ exceptionState.throwTypeError("Malformed RTCConfiguration"); |
+ return 0; |
+ } |
+ |
+ size_t numberOfServers; |
+ ok = iceServers.length(numberOfServers); |
+ if (!ok) { |
+ exceptionState.throwTypeError("Malformed RTCConfiguration"); |
+ return 0; |
} |
RTCBundlePolicy bundlePolicy = RTCBundlePolicyBalanced; |
@@ -193,13 +184,10 @@ RTCConfiguration* RTCPeerConnection::parseConfiguration(const Dictionary& config |
rtcConfiguration->setIceTransports(iceTransports); |
rtcConfiguration->setBundlePolicy(bundlePolicy); |
rtcConfiguration->setRtcpMuxPolicy(rtcpMuxPolicy); |
- if (createIceServerArray) { |
- rtcConfiguration->setIceServers(RTCIceServerArray::create()); |
- } |
for (size_t i = 0; i < numberOfServers; ++i) { |
Dictionary iceServer; |
- bool ok = iceServers.get(i, iceServer); |
+ ok = iceServers.get(i, iceServer); |
if (!ok) { |
exceptionState.throwTypeError("Malformed RTCIceServer"); |
return 0; |
@@ -243,7 +231,7 @@ RTCConfiguration* RTCPeerConnection::parseConfiguration(const Dictionary& config |
return 0; |
} |
- rtcConfiguration->iceServers()->appendServer(RTCIceServer::create(url, username, credential)); |
+ rtcConfiguration->appendServer(RTCIceServer::create(url, username, credential)); |
} |
} |