Bug 1646567 - fix nsDocShell::HasUnloadedParent to work for OOP frames. r=nika

With fission enabled, walking the docshell tree to find unloaded
parents would stop at the first OOP parent. Instead we now walk
the `BrowsingContext`/`WindowContext` tree. To still check parents
which are OOP, we take advantage of the fact that a parent
`WindowContext` will no longer be the current `WindowContext` if
the parent was unloaded. For in process docshell's we additionally
check the docshell directly.

Differential Revision: https://phabricator.services.mozilla.com/D85328
This commit is contained in:
Steven MacLeod 2020-07-31 16:23:58 +00:00
Родитель dd996a396b
Коммит ae5aa0f5bf
2 изменённых файлов: 13 добавлений и 7 удалений

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

@ -12509,14 +12509,20 @@ nsDocShell::GetAsyncPanZoomEnabled(bool* aOut) {
} }
bool nsDocShell::HasUnloadedParent() { bool nsDocShell::HasUnloadedParent() {
RefPtr<nsDocShell> parent = GetInProcessParentDocshell(); for (WindowContext* wc = GetBrowsingContext()->GetParentWindowContext(); wc;
while (parent) { wc->GetParentWindowContext()) {
bool inUnload = false; if (wc->IsCached() || wc->IsDiscarded() ||
parent->GetIsInUnload(&inUnload); wc->GetBrowsingContext()->IsDiscarded()) {
if (inUnload) { // If a parent is OOP and the parent WindowContext is no
// longer current, we can assume the parent was unloaded.
return true;
}
if (wc->GetBrowsingContext()->IsInProcess() &&
(!wc->GetBrowsingContext()->GetDocShell() ||
wc->GetBrowsingContext()->GetDocShell()->GetIsInUnload())) {
return true; return true;
} }
parent = parent->GetInProcessParentDocshell();
} }
return false; return false;
} }

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

@ -460,7 +460,7 @@ interface nsIDocShell : nsIDocShellTreeItem
* Find out whether the docshell is currently in the middle of a page * Find out whether the docshell is currently in the middle of a page
* transition. This is set just before the pagehide/unload events fire. * transition. This is set just before the pagehide/unload events fire.
*/ */
readonly attribute boolean isInUnload; [infallible] readonly attribute boolean isInUnload;
/** /**
* Disconnects this docshell's editor from its window, and stores the * Disconnects this docshell's editor from its window, and stores the