Bug 1879862 - Make `PresShell::HandleEvent` check whether the frame is alive after flushing synthesized mouse move r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D201673
This commit is contained in:
Masayuki Nakano 2024-02-15 23:30:05 +00:00
Родитель 4f2316de76
Коммит d38ecaa856
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -6982,12 +6982,20 @@ nsresult PresShell::HandleEvent(nsIFrame* aFrameForPresShell,
RefPtr<PresShell> rootPresShell =
mPresContext->IsRoot() ? this : GetRootPresShell();
if (rootPresShell && rootPresShell->mSynthMouseMoveEvent.IsPending()) {
AutoWeakFrame frameForPresShellWeak(aFrameForPresShell);
RefPtr<nsSynthMouseMoveEvent> synthMouseMoveEvent =
rootPresShell->mSynthMouseMoveEvent.get();
synthMouseMoveEvent->Run();
}
if (IsDestroying()) {
return NS_OK;
if (IsDestroying()) {
return NS_OK;
}
// XXX If the frame or "this" is reframed, it might be better to
// recompute the frame. However, it could treat the user input on
// unexpected element. Therefore, we should not do that until we'd
// get a bug report caused by that.
if (MOZ_UNLIKELY(!frameForPresShellWeak.IsAlive())) {
return NS_OK;
}
}
break;
}