Bug 524066 - make CSP support dotless hosts, r=dveditz, a=dholbert_sheriff
authorSid Stamm <sstamm@mozilla.com>
Fri, 23 Apr 2010 12:57:51 -0700
changeset 41214 426165b08c0c4b5d952d775c9e5981713b05881a
parent 41213 3d3a5a5ea85614db0c66594b6fe28c2366b4244c
child 41215 11b94fd7854864178f0a3842fa50fd1c1826ed55
push idunknown
push userunknown
push dateunknown
reviewersdveditz, dholbert_sheriff
bugs524066
milestone1.9.3a5pre
Bug 524066 - make CSP support dotless hosts, r=dveditz, a=dholbert_sheriff
content/base/src/CSPUtils.jsm
--- a/content/base/src/CSPUtils.jsm
+++ b/content/base/src/CSPUtils.jsm
@@ -1144,22 +1144,18 @@ CSPHost.fromString = function(aStr) {
   var invalidChar = aStr.match(/[^a-zA-Z0-9\-\.\*]/);
   if (invalidChar) {
     CSPdebug("Invalid character '" + invalidChar + "' in host " + aStr);
     return null;
   }
 
   var hObj = new CSPHost();
   hObj._segments = aStr.split(/\./);
-  if (hObj._segments.length < 1 ||
-      hObj._segments.length == 1 && hObj._segments[0] != "*"
-                                 && hObj._segments[0] != "localhost") {
-    // only short hosts allowed are "*" and "localhost"
+  if (hObj._segments.length < 1)
     return null;
-  }
 
   // validate data in segments
   for (var i in hObj._segments) {
     var seg = hObj._segments[i];
     if (seg == "*") {
       if (i > 0) {
         // Wildcard must be FIRST
         CSPdebug("Wildcard char located at invalid position in '" + aStr + "'");