Bug 1728605 - Part 2: Rename misleading {Window,Browsing}Context::IsCached, r=smaug

This method actually tracks whether the context is current, so it has been
renamed, and the behaviour has been inverted.

Depends on D124210

Differential Revision: https://phabricator.services.mozilla.com/D124211
This commit is contained in:
Nika Layzell
2021-09-02 14:15:04 +00:00
parent 23a18c5bb8
commit 9feface235
7 changed files with 14 additions and 19 deletions

View File

@@ -611,7 +611,7 @@ bool BrowsingContext::IsActive() const {
if (explicit_ != ExplicitActiveStatus::None) {
return explicit_ == ExplicitActiveStatus::Active;
}
if (current->IsCached()) {
if (mParentWindow && !mParentWindow->IsCurrent()) {
return false;
}
} while ((current = current->GetParent()));
@@ -936,12 +936,8 @@ void BrowsingContext::PrepareForProcessChange() {
MOZ_ASSERT(!mWindowProxy);
}
bool BrowsingContext::IsCached() const {
return mParentWindow && mParentWindow->IsCached();
}
bool BrowsingContext::IsTargetable() const {
return !GetClosed() && !mIsDiscarded && !IsCached();
return !GetClosed() && AncestorsAreCurrent();
}
bool BrowsingContext::HasOpener() const {
@@ -956,7 +952,7 @@ bool BrowsingContext::AncestorsAreCurrent() const {
}
if (WindowContext* wc = bc->GetParentWindowContext()) {
if (wc->IsCached() || wc->IsDiscarded()) {
if (!wc->IsCurrent() || wc->IsDiscarded()) {
return false;
}