Undo the checkin for bug 135811 and refix it better. Fixes bug 279495.

r=danm, sr=jst
This commit is contained in:
bzbarsky%mit.edu 2005-01-31 20:46:24 +00:00
Родитель 2082b5ec62
Коммит 7f9e2bbb9a
3 изменённых файлов: 28 добавлений и 13 удалений

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

@ -2089,7 +2089,7 @@ nsDocShell::FindItemWithName(const PRUnichar * aName,
// This may fail, but comparing against null serves the same purpose
nsCOMPtr<nsIDocShellTreeOwner>
reqAsTreeOwner(do_GetInterface(aRequestor));
reqAsTreeOwner(do_QueryInterface(aRequestor));
if (mTreeOwner && mTreeOwner != reqAsTreeOwner) {
return mTreeOwner->

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

@ -214,16 +214,21 @@ NS_IMETHODIMP nsChromeTreeOwner::FindItemWithName(const PRUnichar* aName,
if(fIs_Content)
{
xulWindow->GetPrimaryContentShell(getter_AddRefs(shellAsTreeItem));
if(shellAsTreeItem)
*aFoundItem = shellAsTreeItem;
xulWindow->GetPrimaryContentShell(aFoundItem);
}
else
{
nsCOMPtr<nsIDocShell> shell;
xulWindow->GetDocShell(getter_AddRefs(shell));
shellAsTreeItem = do_QueryInterface(shell);
if(shellAsTreeItem && (aRequestor != shellAsTreeItem.get()))
if (shellAsTreeItem) {
// Get the root tree item of same type, since roots are the only
// things that call into the treeowner to look for named items.
nsCOMPtr<nsIDocShellTreeItem> root;
shellAsTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
shellAsTreeItem = root;
}
if(shellAsTreeItem && aRequestor != shellAsTreeItem)
{
// Do this so we can pass in the tree owner as the requestor so the child knows not
// to call back up.

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

@ -221,16 +221,26 @@ NS_IMETHODIMP nsContentTreeOwner::FindItemWithName(const PRUnichar* aName,
*aFoundItem = shellAsTreeItem;
NS_ADDREF(*aFoundItem);
}
else if(aRequestor != shellAsTreeItem.get())
else
{
// Do this so we can pass in the tree owner as the requestor so the child knows not
// to call back up.
nsCOMPtr<nsIDocShellTreeOwner> shellOwner;
shellAsTreeItem->GetTreeOwner(getter_AddRefs(shellOwner));
nsCOMPtr<nsISupports> shellOwnerSupports(do_QueryInterface(shellOwner));
// Get the root tree item of same type, since roots are the only
// things that call into the treeowner to look for named items.
nsCOMPtr<nsIDocShellTreeItem> root;
shellAsTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
NS_ASSERTION(root, "Must have root tree item of same type");
shellAsTreeItem = root;
if(aRequestor != shellAsTreeItem)
{
// Do this so we can pass in the tree owner as the
// requestor so the child knows not to call back up.
nsCOMPtr<nsIDocShellTreeOwner> shellOwner;
shellAsTreeItem->GetTreeOwner(getter_AddRefs(shellOwner));
nsCOMPtr<nsISupports> shellOwnerSupports(do_QueryInterface(shellOwner));
shellAsTreeItem->FindItemWithName(aName, shellOwnerSupports,
aOriginalRequestor, aFoundItem);
shellAsTreeItem->FindItemWithName(aName, shellOwnerSupports,
aOriginalRequestor,
aFoundItem);
}
}
if(*aFoundItem)
return NS_OK;