mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1325919 - Allow EventTargetFor to be used after last window has been destroyed (r=smaug)
MozReview-Commit-ID: 7p9dnf8KzIx
This commit is contained in:
parent
bc6e0e2c1f
commit
d41fa7c941
@ -51,6 +51,7 @@ TabGroup::~TabGroup()
|
||||
{
|
||||
MOZ_ASSERT(mDocGroups.IsEmpty());
|
||||
MOZ_ASSERT(mWindows.IsEmpty());
|
||||
MOZ_RELEASE_ASSERT(mLastWindowLeft);
|
||||
}
|
||||
|
||||
void
|
||||
@ -149,6 +150,7 @@ TabGroup::Join(nsPIDOMWindowOuter* aWindow, TabGroup* aTabGroup)
|
||||
if (!tabGroup) {
|
||||
tabGroup = new TabGroup();
|
||||
}
|
||||
MOZ_RELEASE_ASSERT(!tabGroup->mLastWindowLeft);
|
||||
MOZ_ASSERT(!tabGroup->mWindows.Contains(aWindow));
|
||||
tabGroup->mWindows.AppendElement(aWindow);
|
||||
return tabGroup.forget();
|
||||
@ -258,7 +260,13 @@ TabGroup::EventTargetFor(TaskCategory aCategory) const
|
||||
MOZ_RELEASE_ASSERT(mThrottledQueuesInitialized || this == sChromeTabGroup);
|
||||
}
|
||||
|
||||
MOZ_RELEASE_ASSERT(!mLastWindowLeft);
|
||||
if (NS_WARN_IF(mLastWindowLeft)) {
|
||||
// Once we've disconnected everything, we still allow people to
|
||||
// dispatch. We'll just go directly to the main thread.
|
||||
nsCOMPtr<nsIEventTarget> main = do_GetMainThread();
|
||||
return main;
|
||||
}
|
||||
|
||||
return mEventTargets[size_t(aCategory)];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user