commit d40333d237ccd252b168858c3ee457c79e8aaff0
parent f62d2edc173647e0b604c749ff1e3deff03064cb
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Fri, 17 Oct 2025 20:26:55 +0000
Bug 1994964 - Fix sendTouchEventToWindow's preventDefault handling. r=smaug
Drive-by. Seems nobody relies on it, only caller is:
https://searchfox.org/firefox-main/rev/1b3787c361452ef9c9e37d8ffd4c414135d547f5/layout/base/tests/marionette/test_accessiblecaret_selection_mode.py#156
Differential Revision: https://phabricator.services.mozilla.com/D269026
Diffstat:
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp
@@ -935,20 +935,14 @@ nsresult nsDOMWindowUtils::SendTouchEventCommon(
nsEventStatus status = nsEventStatus_eIgnore;
if (aToWindow) {
RefPtr<PresShell> presShell = presContext->PresShell();
- // XXX shouldn't this happen _after_ DispatchEvent?
- *aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
- return presShell->HandleEvent(presShell->GetRootFrame(), &event, false,
- &status);
- }
-
- if (aAsyncEnabled == AsyncEnabledOption::ASYNC_ENABLED ||
- StaticPrefs::test_events_async_enabled()) {
+ MOZ_TRY(presShell->HandleEvent(presShell->GetRootFrame(), &event, false,
+ &status));
+ } else if (aAsyncEnabled == AsyncEnabledOption::ASYNC_ENABLED ||
+ StaticPrefs::test_events_async_enabled()) {
status = widget->DispatchInputEvent(&event).mContentStatus;
} else {
- nsresult rv = widget->DispatchEvent(&event, status);
- NS_ENSURE_SUCCESS(rv, rv);
+ MOZ_TRY(widget->DispatchEvent(&event, status));
}
-
if (aPreventDefault) {
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
}