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() {
RefPtr<nsDocShell> parent = GetInProcessParentDocshell();
while (parent) {
bool inUnload = false;
parent->GetIsInUnload(&inUnload);
if (inUnload) {
for (WindowContext* wc = GetBrowsingContext()->GetParentWindowContext(); wc;
wc->GetParentWindowContext()) {
if (wc->IsCached() || wc->IsDiscarded() ||
wc->GetBrowsingContext()->IsDiscarded()) {
// 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;
}
parent = parent->GetInProcessParentDocshell();
}
return false;
}

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

@ -460,7 +460,7 @@ interface nsIDocShell : nsIDocShellTreeItem
* Find out whether the docshell is currently in the middle of a page
* 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