Fixed a couple of problems with FindChildWithName.

This commit is contained in:
tbogard%aol.net 1999-12-03 11:22:54 +00:00
Родитель c9a438d593
Коммит 27bc6e8c92
3 изменённых файлов: 21 добавлений и 38 удалений

Просмотреть файл

@ -451,21 +451,14 @@ nsDocShell::SetMarginHeight(PRInt32 aHeight)
NS_IMETHODIMP nsDocShell::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 nsDocShell::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 nsDocShell::GetParent(nsIDocShellTreeItem** parent)
@ -609,13 +602,13 @@ NS_IMETHODIMP nsDocShell::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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;