Bug 1469329, ensure mRetargetedTouchTargets has touch objects before using it, r=masayuki
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Tue, 19 Jun 2018 11:48:40 +0300
changeset 422959 4cde573c283a56269a37bcb60066c863ba04ddd9
parent 422958 224fbf6776658105ad0ae21e8571ac7e50079431
child 422960 3395984ed40ce4a53e1621fcbeda606ea2c5cb62
push id34160
push userdluca@mozilla.com
push dateTue, 19 Jun 2018 21:55:15 +0000
treeherdermozilla-central@e429320fcdd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1469329
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1469329, ensure mRetargetedTouchTargets has touch objects before using it, r=masayuki
dom/events/EventDispatcher.cpp
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -231,21 +231,23 @@ public:
   }
 
   void RetargetTouchTargets(WidgetTouchEvent* aTouchEvent, Event* aDOMEvent)
   {
     MOZ_ASSERT(HasRetargetTouchTargets());
     MOZ_ASSERT(aTouchEvent,
                "mRetargetedTouchTargets should be empty when dispatching non-touch events.");
 
-    WidgetTouchEvent::TouchArray& touches = aTouchEvent->mTouches;
-    MOZ_ASSERT(!touches.Length() ||
-               touches.Length() == mRetargetedTouchTargets->Length());
-    for (uint32_t i = 0; i < touches.Length(); ++i) {
-      touches[i]->mTarget = mRetargetedTouchTargets->ElementAt(i);
+    if (mRetargetedTouchTargets.isSome()) {
+      WidgetTouchEvent::TouchArray& touches = aTouchEvent->mTouches;
+      MOZ_ASSERT(!touches.Length() ||
+                 touches.Length() == mRetargetedTouchTargets->Length());
+      for (uint32_t i = 0; i < touches.Length(); ++i) {
+        touches[i]->mTarget = mRetargetedTouchTargets->ElementAt(i);
+      }
     }
 
     if (aDOMEvent) {
       // The number of touch objects in targetTouches list may change depending
       // on the retargeting.
       TouchEvent* touchDOMEvent = static_cast<TouchEvent*>(aDOMEvent);
       TouchList* targetTouches = touchDOMEvent->GetExistingTargetTouches();
       if (targetTouches) {