Bug 1247619 - add console warning about OAuth for STUN not yet supported.
MozReview-Commit-ID: L0nViIWiIDn
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -577,16 +577,23 @@ RTCPeerConnection.prototype = {
if (!server.username) {
throw new this._win.DOMException(msg + " - missing username: " + urlStr,
"InvalidAccessError");
}
if (!server.credential) {
throw new this._win.DOMException(msg + " - missing credential: " + urlStr,
"InvalidAccessError");
}
+ if (server.credentialType != "password") {
+ this.logWarning("RTCConfiguration TURN credentialType \""+
+ server.credentialType +
+ "\" is not yet implemented. Treating as password."+
+ " https://bugzil.la/1247616",
+ null, 0);
+ }
}
else if (!(url.scheme in { stun:1, stuns:1 })) {
throw new this._win.DOMException(msg + " - improper scheme: " + url.scheme,
"SyntaxError");
}
if (url.scheme in { stuns:1, turns:1 }) {
this.logWarning(url.scheme.toUpperCase() + " is not yet supported.", null, 0);
}
--- a/dom/webidl/RTCConfiguration.webidl
+++ b/dom/webidl/RTCConfiguration.webidl
@@ -2,21 +2,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCConfiguration
*/
+enum RTCIceCredentialType {
+ "password",
+ "token"
+};
+
dictionary RTCIceServer {
(DOMString or sequence<DOMString>) urls;
DOMString url; //deprecated
- DOMString? credential = null;
- DOMString? username = null;
+ DOMString username;
+ DOMString credential;
+ RTCIceCredentialType credentialType = "password";
};
enum RTCIceTransportPolicy {
"none",
"relay",
"all"
};
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -658,18 +658,18 @@ PeerConnectionConfiguration::AddIceServe
if (hostPos > 1) /* The username was removed */
return NS_ERROR_FAILURE;
path.Mid(host, hostPos, hostLen);
}
if (port == -1)
port = (isStuns || isTurns)? 5349 : 3478;
if (isTurn || isTurns) {
- NS_ConvertUTF16toUTF8 credential(aServer.mCredential);
- NS_ConvertUTF16toUTF8 username(aServer.mUsername);
+ NS_ConvertUTF16toUTF8 credential(aServer.mCredential.Value());
+ NS_ConvertUTF16toUTF8 username(aServer.mUsername.Value());
if (!addTurnServer(host.get(), port,
username.get(),
credential.get(),
(transport.IsEmpty() ?
kNrIceTransportUdp : transport.get()))) {
return NS_ERROR_FAILURE;
}