зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
b123cca8a7
Коммит
b40ab34831
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -376,9 +376,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||
|
||||
void DisplayLoadError(const nsAString& aURI);
|
||||
|
||||
// Determine if the current BrowsingContext is in the BFCache.
|
||||
bool IsCached() const;
|
||||
|
||||
// Check that this browsing context is targetable for navigations (i.e. that
|
||||
// it is neither closed, cached, nor discarded).
|
||||
bool IsTargetable() const;
|
||||
|
|
|
@ -63,8 +63,8 @@ WindowGlobalParent* WindowContext::Canonical() {
|
|||
return static_cast<WindowGlobalParent*>(this);
|
||||
}
|
||||
|
||||
bool WindowContext::IsCached() const {
|
||||
return mBrowsingContext->mCurrentWindowContext != this;
|
||||
bool WindowContext::IsCurrent() const {
|
||||
return mBrowsingContext->mCurrentWindowContext == this;
|
||||
}
|
||||
|
||||
nsGlobalWindowInner* WindowContext::GetInnerWindow() const {
|
||||
|
@ -117,7 +117,7 @@ void WindowContext::AppendChildBrowsingContext(
|
|||
|
||||
// If we're the current WindowContext in our BrowsingContext, make sure to
|
||||
// clear any cached `children` value.
|
||||
if (!IsCached()) {
|
||||
if (IsCurrent()) {
|
||||
BrowsingContext_Binding::ClearCachedChildrenValue(mBrowsingContext);
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ void WindowContext::RemoveChildBrowsingContext(
|
|||
|
||||
// If we're the current WindowContext in our BrowsingContext, make sure to
|
||||
// clear any cached `children` value.
|
||||
if (!IsCached()) {
|
||||
if (IsCurrent()) {
|
||||
BrowsingContext_Binding::ClearCachedChildrenValue(mBrowsingContext);
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ bool WindowContext::HasValidTransientUserGestureActivation() {
|
|||
|
||||
bool WindowContext::ConsumeTransientUserGestureActivation() {
|
||||
MOZ_ASSERT(IsInProcess());
|
||||
MOZ_ASSERT(!IsCached());
|
||||
MOZ_ASSERT(IsCurrent());
|
||||
|
||||
if (!HasValidTransientUserGestureActivation()) {
|
||||
return false;
|
||||
|
|
|
@ -109,7 +109,9 @@ class WindowContext : public nsISupports, public nsWrapperCache {
|
|||
uint64_t OuterWindowId() const { return mOuterWindowId; }
|
||||
bool IsDiscarded() const { return mIsDiscarded; }
|
||||
|
||||
bool IsCached() const;
|
||||
// Returns `true` if this WindowContext is the current WindowContext in its
|
||||
// BrowsingContext.
|
||||
bool IsCurrent() const;
|
||||
|
||||
bool IsInProcess() const { return mIsInProcess; }
|
||||
|
||||
|
|
|
@ -13051,7 +13051,7 @@ nsDocShell::GetAsyncPanZoomEnabled(bool* aOut) {
|
|||
bool nsDocShell::HasUnloadedParent() {
|
||||
for (WindowContext* wc = GetBrowsingContext()->GetParentWindowContext(); wc;
|
||||
wc = wc->GetParentWindowContext()) {
|
||||
if (wc->IsCached() || wc->IsDiscarded() ||
|
||||
if (!wc->IsCurrent() || 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.
|
||||
|
|
|
@ -2755,7 +2755,7 @@ bool nsPIDOMWindowInner::IsCurrentInnerWindow() const {
|
|||
|
||||
bool nsPIDOMWindowInner::IsFullyActive() const {
|
||||
WindowContext* wc = GetWindowContext();
|
||||
if (!wc || wc->IsDiscarded() || wc->IsCached()) {
|
||||
if (!wc || wc->IsDiscarded() || !wc->IsCurrent()) {
|
||||
return false;
|
||||
}
|
||||
return GetBrowsingContext()->AncestorsAreCurrent();
|
||||
|
|
|
@ -1162,7 +1162,7 @@ bool PaymentRequest::InFullyActiveDocument() {
|
|||
}
|
||||
|
||||
while (winContext) {
|
||||
if (winContext->IsCached()) {
|
||||
if (!winContext->IsCurrent()) {
|
||||
return false;
|
||||
}
|
||||
winContext = winContext->GetParentWindowContext();
|
||||
|
|
Загрузка…
Ссылка в новой задаче