Bug 1247619 - add console warning about OAuth for STUN not yet supported. draft
authorJan-Ivar Bruaroey <jib@mozilla.com>
Thu, 25 Feb 2016 00:24:16 -0500
changeset 334590 b0b6789458ace8328b375a661b829968e818aec5
parent 334023 db96fab092745799090efc3ab378c6efa2599a22
child 514950 e60a63524dc2903b42a4cf1f08c3c5777f711968
push id11589
push userjbruaroey@mozilla.com
push dateThu, 25 Feb 2016 17:42:44 +0000
bugs1247619
milestone47.0a1
Bug 1247619 - add console warning about OAuth for STUN not yet supported. MozReview-Commit-ID: L0nViIWiIDn
dom/media/PeerConnection.js
dom/webidl/RTCConfiguration.webidl
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
--- 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;
       }