Bug 1594288 - Remove nsIDocShellTreeItem.findChildWithName. r=annyG

Differential Revision: https://phabricator.services.mozilla.com/D55977

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Farre 2019-12-12 13:29:39 +00:00
Родитель 1d6c24996c
Коммит 5d24eee475
3 изменённых файлов: 0 добавлений и 98 удалений

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

@ -2847,17 +2847,6 @@ bool nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
aConsiderOpener);
}
static bool ItemIsActive(nsIDocShellTreeItem* aItem) {
if (nsCOMPtr<nsPIDOMWindowOuter> window = aItem->GetWindow()) {
auto* win = nsGlobalWindowOuter::Cast(window);
if (!win->GetClosedOuter()) {
return true;
}
}
return false;
}
void nsDocShell::AssertOriginAttributesMatchPrivateBrowsing() {
// Chrome docshells must not have a private browsing OriginAttribute
// Content docshells must maintain the equality:
@ -3180,62 +3169,6 @@ nsDocShell* nsDocShell::GetInProcessChildAt(int32_t aIndex) {
return static_cast<nsDocShell*>(child);
}
NS_IMETHODIMP
nsDocShell::FindChildWithName(const nsAString& aName, bool aRecurse,
bool aSameType, nsIDocShellTreeItem* aRequestor,
nsIDocShellTreeItem* aOriginalRequestor,
nsIDocShellTreeItem** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
// if we don't find one, we return NS_OK and a null result
*aResult = nullptr;
if (aName.IsEmpty()) {
return NS_OK;
}
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryObject(iter.GetNext());
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
int32_t childType = child->ItemType();
if (aSameType && (childType != mItemType)) {
continue;
}
bool childNameEquals = false;
child->NameEquals(aName, &childNameEquals);
if (childNameEquals && ItemIsActive(child) &&
CanAccessItem(child, aOriginalRequestor)) {
child.swap(*aResult);
break;
}
// Only ask it to check children if it is same type
if (childType != mItemType) {
continue;
}
// Only ask the child if it isn't the requestor
if (aRecurse && (aRequestor != child)) {
// See if child contains the shell with the given name
#ifdef DEBUG
nsresult rv =
#endif
child->FindChildWithName(aName, true, aSameType,
static_cast<nsIDocShellTreeItem*>(this),
aOriginalRequestor, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "FindChildWithName should not fail here");
if (*aResult) {
// found it
return NS_OK;
}
}
}
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::AddChildSHEntry(nsISHEntry* aCloneRef, nsISHEntry* aNewEntry,
int32_t aChildOffset, uint32_t aLoadType,

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

@ -153,26 +153,6 @@ interface nsIDocShellTreeItem : nsISupports
[binaryname(GetInProcessChildAt)]
nsIDocShellTreeItem getChildAt(in long index);
/*
Return the child DocShellTreeItem with the specified name.
aName - This is the name of the item that is trying to be found.
aRecurse - Is used to tell the function to recurse through children.
Note, recursion will only happen through items of the same type.
aSameType - If this is set only children of the same type will be returned.
aRequestor - This is the docshellTreeItem that is requesting the find. This
parameter is used when recursion is being used to avoid searching the same
tree again when a child has asked a parent to search for children.
aOriginalRequestor - The original treeitem that made the request, if any.
This is used to ensure that we don't run into cross-site issues.
Note the search is depth first when recursing.
*/
nsIDocShellTreeItem findChildWithName(in AString aName,
in boolean aRecurse,
in boolean aSameType,
in nsIDocShellTreeItem aRequestor,
in nsIDocShellTreeItem aOriginalRequestor);
/**
* BrowsingContext associated with the DocShell.
*/

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

@ -472,17 +472,6 @@ nsWebBrowser::GetInProcessChildAt(int32_t aIndex,
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP
nsWebBrowser::FindChildWithName(const nsAString& aName, bool aRecurse,
bool aSameType, nsIDocShellTreeItem* aRequestor,
nsIDocShellTreeItem* aOriginalRequestor,
nsIDocShellTreeItem** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nullptr;
return NS_OK;
}
//*****************************************************************************
// nsWebBrowser::nsIWebNavigation
//*****************************************************************************