Bug 958741 - Add IDN support to peerIdentity name validation. r=abr
authorMartin Thomson <martin.thomson@gmail.com>
Thu, 23 Jan 2014 06:22:12 +0100
changeset 170911 dd0f72140555e291f05dc29e9de7d40d99f649ad
parent 170910 5d9a2c52728afef2770f3a9bec363e88b5100dbc
child 170912 a21fc292b2eac11ef03e18675d98c8ceb17adf52
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersabr
bugs958741
milestone30.0a1
Bug 958741 - Add IDN support to peerIdentity name validation. r=abr
dom/media/PeerConnectionIdp.jsm
--- a/dom/media/PeerConnectionIdp.jsm
+++ b/dom/media/PeerConnectionIdp.jsm
@@ -151,19 +151,20 @@ PeerConnectionIdp.prototype = {
       let tail = name.substring(atIdx + 1);
 
       // strip the port number, if present
       let provider = this.provider;
       let providerPortIdx = provider.indexOf(":");
       if (providerPortIdx > 0) {
         provider = provider.substring(0, providerPortIdx);
       }
-      // this really isn't correct for IDN names
-      // Bug 958741 will fix that
-      if (tail.toLowerCase() !== provider.toLowerCase()) {
+      var idnService = Components.classes["@mozilla.org/network/idn-service;1"].
+        getService(Components.interfaces.nsIIDNService);
+      if (idnService.convertUTF8toACE(tail) !==
+          idnService.convertUTF8toACE(provider)) {
         return "name '" + identity.name +
             "' doesn't match IdP: '" + this.provider + "'";
       }
       return null;
     }
     return "missing authority in name from IdP";
   },