зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1675820 - Part 2: Trace inner window mBrowsingContext and mWindowGlobalChild fields, r=smaug
When these fields were added, it appears I completely forgot to add them to the cycle collection unlink logic. This somehow didn't cause leaks due to existing code which would break the cycles between the inner window and the outer window / BrowsingContext. Differential Revision: https://phabricator.services.mozilla.com/D108118
This commit is contained in:
Родитель
51907e2d1f
Коммит
5e9e049d24
|
@ -1451,6 +1451,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeEventHandler)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFocusedElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBrowsingContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindowGlobalChild)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMenubar)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mToolbar)
|
||||
|
@ -1552,6 +1554,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChromeEventHandler)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParentTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFocusedElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBrowsingContext)
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
!tmp->mWindowGlobalChild || tmp->mWindowGlobalChild->IsClosed(),
|
||||
"How are we unlinking a window before its actor has been destroyed?");
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindowGlobalChild)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMenubar)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mToolbar)
|
||||
|
@ -2745,16 +2753,13 @@ bool nsPIDOMWindowInner::HasOpenWebSockets() const {
|
|||
}
|
||||
|
||||
bool nsPIDOMWindowInner::IsCurrentInnerWindow() const {
|
||||
auto* bc = GetBrowsingContext();
|
||||
MOZ_ASSERT(bc);
|
||||
|
||||
if (bc->IsDiscarded()) {
|
||||
if (!mBrowsingContext || mBrowsingContext->IsDiscarded()) {
|
||||
// If our BrowsingContext has been discarded, we consider ourselves
|
||||
// still-current if we were current at the time it was discarded.
|
||||
return mOuterWindow && WasCurrentInnerWindow();
|
||||
}
|
||||
|
||||
nsPIDOMWindowOuter* outer = bc->GetDOMWindow();
|
||||
nsPIDOMWindowOuter* outer = mBrowsingContext->GetDOMWindow();
|
||||
return outer && outer->GetCurrentInnerWindow() == this;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче