Fixed a couple of problems with FindChildWithName.
git-svn-id: svn://10.0.0.236/trunk@55189 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1455,7 +1455,9 @@ nsWebShell::FindChildWithName(const PRUnichar* aName1,
|
||||
|
||||
NS_ENSURE_SUCCESS(FindChildWithName(aName1, getter_AddRefs(treeItem)),
|
||||
NS_ERROR_FAILURE);
|
||||
CallQueryInterface(treeItem.get(), &aResult);
|
||||
|
||||
if(treeItem)
|
||||
CallQueryInterface(treeItem.get(), &aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -4375,21 +4377,14 @@ nsWebShell::SetMarginHeight(PRInt32 aHeight)
|
||||
NS_IMETHODIMP nsWebShell::GetName(PRUnichar** aName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aName);
|
||||
*aName = nsnull;
|
||||
if(0 != mName.Length())
|
||||
*aName = mName.ToNewUnicode();
|
||||
*aName = mName.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::SetName(const PRUnichar* aName)
|
||||
{
|
||||
if (aName) {
|
||||
mName = aName; // this does a copy of aName
|
||||
}
|
||||
else {
|
||||
mName = "";
|
||||
}
|
||||
return NS_OK;
|
||||
mName = aName; // this does a copy of aName
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GetParent(nsIDocShellTreeItem** parent)
|
||||
@@ -4533,13 +4528,13 @@ NS_IMETHODIMP nsWebShell::FindChildWithName(const PRUnichar *aName, nsIDocShellT
|
||||
|
||||
*_retval = nsnull; // if we don't find one, we return NS_OK and a null result
|
||||
nsAutoString name(aName);
|
||||
PRUnichar *childName;
|
||||
nsXPIDLString childName;
|
||||
PRInt32 i, n = mChildren.Count();
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
nsIDocShellTreeItem* child = (nsIDocShellTreeItem*) mChildren.ElementAt(i); // doesn't addref the result
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
||||
child->GetName(&childName);
|
||||
child->GetName(getter_Copies(childName));
|
||||
if(name.Equals(childName))
|
||||
{
|
||||
*_retval = child;
|
||||
|
||||
Reference in New Issue
Block a user