B2G/gecko/toolkit/forgetaboutsite/ForgetAboutSite.jsm
/**
 * Returns true if the string passed in is part of the root domain of the
 * current string.  For example, if this is "www.mozilla.org", and we pass in
 * "mozilla.org", this will return true.  It would return false the other way
 * around.
 */
Returns true if the string passed in is part of the root domain of the
current string.
Returns true if the string passed in is part of the root domain of the current string .
function hasRootDomain(str, aDomain)
{
  let index = str.indexOf(aDomain);
  if (index == -1)
    return false;
  if (str == aDomain)
    return true;
  let prevChar = str[index - 1];
  return (index == (str.length - aDomain.length)) &&
         (prevChar == "." || prevChar == "/");
}
function hasRootDomain ( str , aDomain ) { let index = str . indexOf ( aDomain ) ; if ( index == - 1 ) return false ; if ( str == aDomain ) return true ; let prevChar = str [ index - 1 ] ; return ( index == ( str . length - aDomain . length ) ) && ( prevChar == "." || prevChar == "/" ) ; }
Returns true if the string passed in is part of the root domain of the
 current string.
Returns true if the string passed in is part of the root domain of the current string .
// If aDomain is not found, we know we do not have it as a root domain. // If the strings are the same, we obviously have a match. // Otherwise, we have aDomain as our root domain iff the index of aDomain is // aDomain.length subtracted from our length and (since we do not have an // exact match) the character before the index is a dot or slash.