зеркало из 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
|
// This may fail, but comparing against null serves the same purpose
|
||||||
nsCOMPtr<nsIDocShellTreeOwner>
|
nsCOMPtr<nsIDocShellTreeOwner>
|
||||||
reqAsTreeOwner(do_GetInterface(aRequestor));
|
reqAsTreeOwner(do_QueryInterface(aRequestor));
|
||||||
|
|
||||||
if (mTreeOwner && mTreeOwner != reqAsTreeOwner) {
|
if (mTreeOwner && mTreeOwner != reqAsTreeOwner) {
|
||||||
return mTreeOwner->
|
return mTreeOwner->
|
||||||
|
|
|
@ -214,16 +214,21 @@ NS_IMETHODIMP nsChromeTreeOwner::FindItemWithName(const PRUnichar* aName,
|
||||||
|
|
||||||
if(fIs_Content)
|
if(fIs_Content)
|
||||||
{
|
{
|
||||||
xulWindow->GetPrimaryContentShell(getter_AddRefs(shellAsTreeItem));
|
xulWindow->GetPrimaryContentShell(aFoundItem);
|
||||||
if(shellAsTreeItem)
|
|
||||||
*aFoundItem = shellAsTreeItem;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShell> shell;
|
nsCOMPtr<nsIDocShell> shell;
|
||||||
xulWindow->GetDocShell(getter_AddRefs(shell));
|
xulWindow->GetDocShell(getter_AddRefs(shell));
|
||||||
shellAsTreeItem = do_QueryInterface(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
|
// Do this so we can pass in the tree owner as the requestor so the child knows not
|
||||||
// to call back up.
|
// to call back up.
|
||||||
|
|
|
@ -221,16 +221,26 @@ NS_IMETHODIMP nsContentTreeOwner::FindItemWithName(const PRUnichar* aName,
|
||||||
*aFoundItem = shellAsTreeItem;
|
*aFoundItem = shellAsTreeItem;
|
||||||
NS_ADDREF(*aFoundItem);
|
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
|
// Get the root tree item of same type, since roots are the only
|
||||||
// to call back up.
|
// 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;
|
nsCOMPtr<nsIDocShellTreeOwner> shellOwner;
|
||||||
shellAsTreeItem->GetTreeOwner(getter_AddRefs(shellOwner));
|
shellAsTreeItem->GetTreeOwner(getter_AddRefs(shellOwner));
|
||||||
nsCOMPtr<nsISupports> shellOwnerSupports(do_QueryInterface(shellOwner));
|
nsCOMPtr<nsISupports> shellOwnerSupports(do_QueryInterface(shellOwner));
|
||||||
|
|
||||||
shellAsTreeItem->FindItemWithName(aName, shellOwnerSupports,
|
shellAsTreeItem->FindItemWithName(aName, shellOwnerSupports,
|
||||||
aOriginalRequestor, aFoundItem);
|
aOriginalRequestor,
|
||||||
|
aFoundItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(*aFoundItem)
|
if(*aFoundItem)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче