Bug 611503 Fix broken consumers of nsTDependentString on an nsTAString r=dwitte

This commit is contained in:
Neil Rashbrook 2011-03-25 11:43:15 +00:00
parent f0721f4c06
commit 1439913c4c
3 changed files with 6 additions and 9 deletions

View File

@ -494,9 +494,9 @@ XULSortServiceImpl::CompareValues(const nsAString& aLeft,
{
if (aSortHints & SORT_INTEGER) {
PRInt32 err;
PRInt32 leftint = nsDependentString(aLeft).ToInteger(&err);
PRInt32 leftint = PromiseFlatString(aLeft).ToInteger(&err);
if (NS_SUCCEEDED(err)) {
PRInt32 rightint = nsDependentString(aRight).ToInteger(&err);
PRInt32 rightint = PromiseFlatString(aRight).ToInteger(&err);
if (NS_SUCCEEDED(err)) {
return leftint - rightint;
}

View File

@ -352,7 +352,7 @@ NS_IMETHODIMP nsPrefService::ClearContentPref(const nsACString& aPrefName)
NS_IMETHODIMP nsPrefService::MirrorPreference(const nsACString& aPrefName,
PrefTuple *aPref)
{
PrefHashEntry *pref = pref_HashTableLookup(nsDependentCString(aPrefName).get());
PrefHashEntry *pref = pref_HashTableLookup(PromiseFlatCString(aPrefName).get());
if (!pref)
return NS_ERROR_NOT_AVAILABLE;

View File

@ -3024,14 +3024,11 @@ nsCookieService::GetBaseDomainFromHost(const nsACString &aHost,
return NS_ERROR_INVALID_ARG;
// aHost may contain a leading dot; if so, strip it now.
nsDependentCString host(aHost);
PRBool domain = !host.IsEmpty() && host.First() == '.';
if (domain)
host.Rebind(host.BeginReading() + 1, host.EndReading());
PRBool domain = !aHost.IsEmpty() && aHost.First() == '.';
// get the base domain. this will fail if the host contains a leading dot,
// more than one trailing dot, or is otherwise malformed.
nsresult rv = mTLDService->GetBaseDomainFromHost(host, 0, aBaseDomain);
nsresult rv = mTLDService->GetBaseDomainFromHost(Substring(aHost, domain), 0, aBaseDomain);
if (rv == NS_ERROR_HOST_IS_IP_ADDRESS ||
rv == NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS) {
// aHost is either an IP address, an alias such as 'localhost', an eTLD
@ -3041,7 +3038,7 @@ nsCookieService::GetBaseDomainFromHost(const nsACString &aHost,
if (domain)
return NS_ERROR_INVALID_ARG;
aBaseDomain = host;
aBaseDomain = aHost;
return NS_OK;
}
return rv;