Backed out changeset 9fa5c8e5fc13 (bug 1868023) for causing assertion failures in nsWindowMemoryReporter.cpp

This commit is contained in:
Noemi Erli
2023-12-04 14:49:14 +02:00
parent c7d7b2e722
commit afbc5d21aa
4 changed files with 62 additions and 5 deletions

View File

@@ -2708,6 +2708,25 @@ nsDocShell::GetInProcessSameTypeParent(nsIDocShellTreeItem** aParent) {
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetSameTypeInProcessParentIgnoreBrowserBoundaries(
nsIDocShell** aParent) {
NS_ENSURE_ARG_POINTER(aParent);
*aParent = nullptr;
nsCOMPtr<nsIDocShellTreeItem> parent =
do_QueryInterface(GetAsSupports(mParent));
if (!parent) {
return NS_OK;
}
if (parent->ItemType() == mItemType) {
nsCOMPtr<nsIDocShell> parentDS = do_QueryInterface(parent);
parentDS.forget(aParent);
}
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetInProcessRootTreeItem(nsIDocShellTreeItem** aRootTreeItem) {
NS_ENSURE_ARG_POINTER(aRootTreeItem);

View File

@@ -539,6 +539,14 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
[infallible] readonly attribute boolean isTopLevelContentDocShell;
/**
* Like nsIDocShellTreeItem::GetSameTypeParent, except this ignores <iframe
* mozbrowser> boundaries. Which no longer exist.
*
* @deprecated: Use `BrowsingContext::GetParent()` in the future.
*/
nsIDocShell getSameTypeInProcessParentIgnoreBrowserBoundaries();
/**
* True iff asynchronous panning and zooming is enabled for this
* docshell.

View File

@@ -3124,13 +3124,26 @@ nsPIDOMWindowOuter* nsGlobalWindowOuter::GetInProcessScriptableParentOrNull() {
return (nsGlobalWindowOuter::Cast(parent) == this) ? nullptr : parent;
}
/**
* nsPIDOMWindow::GetParent (when called from C++) is just a wrapper around
* GetRealParent.
*/
already_AddRefed<nsPIDOMWindowOuter> nsGlobalWindowOuter::GetInProcessParent() {
if (auto* parentBC = GetBrowsingContext()->GetParent()) {
if (auto* parent = parentBC->GetDOMWindow()) {
return do_AddRef(parent);
}
if (!mDocShell) {
return nullptr;
}
return do_AddRef(this);
nsCOMPtr<nsIDocShell> parent;
mDocShell->GetSameTypeInProcessParentIgnoreBrowserBoundaries(
getter_AddRefs(parent));
if (parent) {
nsCOMPtr<nsPIDOMWindowOuter> win = parent->GetWindow();
return win.forget();
}
nsCOMPtr<nsPIDOMWindowOuter> win(this);
return win.forget();
}
static nsresult GetTopImpl(nsGlobalWindowOuter* aWin, nsIURI* aURIBeingLoaded,

View File

@@ -2652,6 +2652,23 @@
}
]
},
{
"flags": [
"hasretval"
],
"name": "getSameTypeInProcessParentIgnoreBrowserBoundaries",
"params": [
{
"flags": [
"out"
],
"type": {
"name": "nsIDocShell",
"tag": "TD_INTERFACE_TYPE"
}
}
]
},
{
"flags": [
"getter",