зеркало из https://github.com/mozilla/gecko-dev.git
Undo the checkin for bug 135811 and refix it better. Fixes bug 279495.
r=danm, sr=jst
This commit is contained in:
Родитель
2082b5ec62
Коммит
7f9e2bbb9a
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче