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,13 +6982,21 @@ nsresult PresShell::HandleEvent(nsIFrame* aFrameForPresShell,
RefPtr<PresShell> rootPresShell = RefPtr<PresShell> rootPresShell =
mPresContext->IsRoot() ? this : GetRootPresShell(); mPresContext->IsRoot() ? this : GetRootPresShell();
if (rootPresShell && rootPresShell->mSynthMouseMoveEvent.IsPending()) { if (rootPresShell && rootPresShell->mSynthMouseMoveEvent.IsPending()) {
AutoWeakFrame frameForPresShellWeak(aFrameForPresShell);
RefPtr<nsSynthMouseMoveEvent> synthMouseMoveEvent = RefPtr<nsSynthMouseMoveEvent> synthMouseMoveEvent =
rootPresShell->mSynthMouseMoveEvent.get(); rootPresShell->mSynthMouseMoveEvent.get();
synthMouseMoveEvent->Run(); synthMouseMoveEvent->Run();
}
if (IsDestroying()) { if (IsDestroying()) {
return NS_OK; 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; break;
} }
default: default: