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

@@ -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;