Bug 220093 inCSSValueSearch incorrectly uses strings

r=caillon sr=bz
This commit is contained in:
timeless%mozdev.org 2006-05-17 02:38:17 +00:00
parent b17a188d9d
commit f75c8c97ff
2 changed files with 10 additions and 14 deletions

View File

@ -49,9 +49,6 @@ static NS_DEFINE_CID(kInspectorCSSUtilsCID, NS_INSPECTORCSSUTILS_CID);
inCSSValueSearch::inCSSValueSearch()
: mResults(nsnull),
mProperties(nsnull),
mLastResult(nsnull),
mBaseURL(nsnull),
mTextCriteria(nsnull),
mResultCount(0),
mPropertyCount(0),
mIsActive(PR_FALSE),
@ -154,7 +151,7 @@ inCSSValueSearch::GetStringResultAt(PRInt32 aIndex, nsAString& _retval)
nsAutoString* result = (nsAutoString*)mResults->ElementAt(aIndex);
_retval = *result;
} else if (aIndex == mResultCount-1) {
_retval = *mLastResult;
_retval = mLastResult;
} else {
return NS_ERROR_FAILURE;
}
@ -194,16 +191,15 @@ inCSSValueSearch::SetDocument(nsIDOMDocument* aDocument)
NS_IMETHODIMP
inCSSValueSearch::GetBaseURL(PRUnichar** aBaseURL)
{
*aBaseURL = ToNewUnicode(*mBaseURL);
if (!(*aBaseURL = ToNewUnicode(mBaseURL)))
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
inCSSValueSearch::SetBaseURL(const PRUnichar* aBaseURL)
{
nsAutoString url;
mBaseURL = &url;
url.Assign(aBaseURL);
mBaseURL.Assign(aBaseURL);
return NS_OK;
}
@ -248,15 +244,15 @@ inCSSValueSearch::AddPropertyCriteria(const PRUnichar *aPropName)
NS_IMETHODIMP
inCSSValueSearch::GetTextCriteria(PRUnichar** aTextCriteria)
{
*aTextCriteria = ToNewUnicode(*mTextCriteria);
if (!(*aTextCriteria = ToNewUnicode(mTextCriteria)))
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
inCSSValueSearch::SetTextCriteria(const PRUnichar* aTextCriteria)
{
if (!mTextCriteria) mTextCriteria = new nsAutoString();
mTextCriteria->Assign(aTextCriteria);
mTextCriteria.Assign(aTextCriteria);
return NS_OK;
}

View File

@ -68,9 +68,9 @@ protected:
nsCOMPtr<nsIDOMDocument> mDocument;
nsVoidArray* mResults;
nsCSSProperty* mProperties;
nsAutoString* mLastResult;
nsAutoString* mBaseURL;
nsAutoString* mTextCriteria;
nsString mLastResult;
nsString mBaseURL;
nsString mTextCriteria;
PRInt32 mResultCount;
PRUint32 mPropertyCount;
PRBool mIsActive;