зеркало из https://github.com/mozilla/pjs.git
Fixed a couple of problems with FindChildWithName.
This commit is contained in:
Родитель
c9a438d593
Коммит
27bc6e8c92
|
@ -451,21 +451,14 @@ nsDocShell::SetMarginHeight(PRInt32 aHeight)
|
||||||
NS_IMETHODIMP nsDocShell::GetName(PRUnichar** aName)
|
NS_IMETHODIMP nsDocShell::GetName(PRUnichar** aName)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aName);
|
NS_ENSURE_ARG_POINTER(aName);
|
||||||
*aName = nsnull;
|
*aName = mName.ToNewUnicode();
|
||||||
if(0 != mName.Length())
|
|
||||||
*aName = mName.ToNewUnicode();
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShell::SetName(const PRUnichar* aName)
|
NS_IMETHODIMP nsDocShell::SetName(const PRUnichar* aName)
|
||||||
{
|
{
|
||||||
if (aName) {
|
mName = aName; // this does a copy of aName
|
||||||
mName = aName; // this does a copy of aName
|
return NS_OK;
|
||||||
}
|
|
||||||
else {
|
|
||||||
mName = "";
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShell::GetParent(nsIDocShellTreeItem** parent)
|
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
|
*_retval = nsnull; // if we don't find one, we return NS_OK and a null result
|
||||||
nsAutoString name(aName);
|
nsAutoString name(aName);
|
||||||
PRUnichar *childName;
|
nsXPIDLString childName;
|
||||||
PRInt32 i, n = mChildren.Count();
|
PRInt32 i, n = mChildren.Count();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
nsIDocShellTreeItem* child = (nsIDocShellTreeItem*) mChildren.ElementAt(i); // doesn't addref the result
|
nsIDocShellTreeItem* child = (nsIDocShellTreeItem*) mChildren.ElementAt(i); // doesn't addref the result
|
||||||
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
||||||
child->GetName(&childName);
|
child->GetName(getter_Copies(childName));
|
||||||
if(name.Equals(childName))
|
if(name.Equals(childName))
|
||||||
{
|
{
|
||||||
*_retval = child;
|
*_retval = child;
|
||||||
|
|
|
@ -1455,7 +1455,9 @@ nsWebShell::FindChildWithName(const PRUnichar* aName1,
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(FindChildWithName(aName1, getter_AddRefs(treeItem)),
|
NS_ENSURE_SUCCESS(FindChildWithName(aName1, getter_AddRefs(treeItem)),
|
||||||
NS_ERROR_FAILURE);
|
NS_ERROR_FAILURE);
|
||||||
CallQueryInterface(treeItem.get(), &aResult);
|
|
||||||
|
if(treeItem)
|
||||||
|
CallQueryInterface(treeItem.get(), &aResult);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -4375,21 +4377,14 @@ nsWebShell::SetMarginHeight(PRInt32 aHeight)
|
||||||
NS_IMETHODIMP nsWebShell::GetName(PRUnichar** aName)
|
NS_IMETHODIMP nsWebShell::GetName(PRUnichar** aName)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aName);
|
NS_ENSURE_ARG_POINTER(aName);
|
||||||
*aName = nsnull;
|
*aName = mName.ToNewUnicode();
|
||||||
if(0 != mName.Length())
|
|
||||||
*aName = mName.ToNewUnicode();
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsWebShell::SetName(const PRUnichar* aName)
|
NS_IMETHODIMP nsWebShell::SetName(const PRUnichar* aName)
|
||||||
{
|
{
|
||||||
if (aName) {
|
mName = aName; // this does a copy of aName
|
||||||
mName = aName; // this does a copy of aName
|
return NS_OK;
|
||||||
}
|
|
||||||
else {
|
|
||||||
mName = "";
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsWebShell::GetParent(nsIDocShellTreeItem** parent)
|
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
|
*_retval = nsnull; // if we don't find one, we return NS_OK and a null result
|
||||||
nsAutoString name(aName);
|
nsAutoString name(aName);
|
||||||
PRUnichar *childName;
|
nsXPIDLString childName;
|
||||||
PRInt32 i, n = mChildren.Count();
|
PRInt32 i, n = mChildren.Count();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
nsIDocShellTreeItem* child = (nsIDocShellTreeItem*) mChildren.ElementAt(i); // doesn't addref the result
|
nsIDocShellTreeItem* child = (nsIDocShellTreeItem*) mChildren.ElementAt(i); // doesn't addref the result
|
||||||
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
||||||
child->GetName(&childName);
|
child->GetName(getter_Copies(childName));
|
||||||
if(name.Equals(childName))
|
if(name.Equals(childName))
|
||||||
{
|
{
|
||||||
*_retval = child;
|
*_retval = child;
|
||||||
|
|
|
@ -1455,7 +1455,9 @@ nsWebShell::FindChildWithName(const PRUnichar* aName1,
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(FindChildWithName(aName1, getter_AddRefs(treeItem)),
|
NS_ENSURE_SUCCESS(FindChildWithName(aName1, getter_AddRefs(treeItem)),
|
||||||
NS_ERROR_FAILURE);
|
NS_ERROR_FAILURE);
|
||||||
CallQueryInterface(treeItem.get(), &aResult);
|
|
||||||
|
if(treeItem)
|
||||||
|
CallQueryInterface(treeItem.get(), &aResult);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -4375,21 +4377,14 @@ nsWebShell::SetMarginHeight(PRInt32 aHeight)
|
||||||
NS_IMETHODIMP nsWebShell::GetName(PRUnichar** aName)
|
NS_IMETHODIMP nsWebShell::GetName(PRUnichar** aName)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aName);
|
NS_ENSURE_ARG_POINTER(aName);
|
||||||
*aName = nsnull;
|
*aName = mName.ToNewUnicode();
|
||||||
if(0 != mName.Length())
|
|
||||||
*aName = mName.ToNewUnicode();
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsWebShell::SetName(const PRUnichar* aName)
|
NS_IMETHODIMP nsWebShell::SetName(const PRUnichar* aName)
|
||||||
{
|
{
|
||||||
if (aName) {
|
mName = aName; // this does a copy of aName
|
||||||
mName = aName; // this does a copy of aName
|
return NS_OK;
|
||||||
}
|
|
||||||
else {
|
|
||||||
mName = "";
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsWebShell::GetParent(nsIDocShellTreeItem** parent)
|
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
|
*_retval = nsnull; // if we don't find one, we return NS_OK and a null result
|
||||||
nsAutoString name(aName);
|
nsAutoString name(aName);
|
||||||
PRUnichar *childName;
|
nsXPIDLString childName;
|
||||||
PRInt32 i, n = mChildren.Count();
|
PRInt32 i, n = mChildren.Count();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
nsIDocShellTreeItem* child = (nsIDocShellTreeItem*) mChildren.ElementAt(i); // doesn't addref the result
|
nsIDocShellTreeItem* child = (nsIDocShellTreeItem*) mChildren.ElementAt(i); // doesn't addref the result
|
||||||
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
||||||
child->GetName(&childName);
|
child->GetName(getter_Copies(childName));
|
||||||
if(name.Equals(childName))
|
if(name.Equals(childName))
|
||||||
{
|
{
|
||||||
*_retval = child;
|
*_retval = child;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче