Bug 1250560 - Fix crash in HandleTouchEvent. r?roc
When enabling "dom.w3c_pointer_events.enabled", we might get a
eTouchCancel event without any touch data. That is, aEvent->touches is
an empty array. We need to make sure it's non-empty before accessing
aEvent->touches[0].
MozReview-Commit-ID: BQUsrJjHHEl
--- a/layout/base/AccessibleCaretEventHub.cpp
+++ b/layout/base/AccessibleCaretEventHub.cpp
@@ -541,16 +541,21 @@ AccessibleCaretEventHub::HandleMouseEven
}
return rv;
}
nsEventStatus
AccessibleCaretEventHub::HandleTouchEvent(WidgetTouchEvent* aEvent)
{
+ if (aEvent->touches.IsEmpty()) {
+ AC_LOG("%s: Receive a touch event without any touch data!", __FUNCTION__);
+ return nsEventStatus_eIgnore;
+ }
+
nsEventStatus rv = nsEventStatus_eIgnore;
int32_t id = (mActiveTouchId == kInvalidTouchId ?
aEvent->touches[0]->Identifier() : mActiveTouchId);
nsPoint point = GetTouchEventPosition(aEvent, id);
switch (aEvent->mMessage) {
case eTouchStart: