Bug 1467743 - [marionette] Handle errors for nested promise in dispatchPointerMove. r=ato
authorHenrik Skupin <mail@hskupin.info>
Fri, 08 Jun 2018 13:11:30 +0200
changeset 421949 e8cc844125d523b0d1b944d5bea9a3c031a283c8
parent 421948 2140cc056ad0178c9083ef28ef45d76136c0fd5d
child 421950 de1b1661fad8d64741abe9795b1f0301f53e7954
push id34110
push usercbrindusan@mozilla.com
push dateFri, 08 Jun 2018 21:51:53 +0000
treeherdermozilla-central@54c9df81e008 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1467743
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 1467743 - [marionette] Handle errors for nested promise in dispatchPointerMove. r=ato Because the nested promise doesn't use the "catch()" method a possible raised error by its code is not handled, and will cause the outer promise never to resolve, which results in an infinite hang. MozReview-Commit-ID: 1MFyKpmOjYz
testing/marionette/action.js
--- a/testing/marionette/action.js
+++ b/testing/marionette/action.js
@@ -1315,17 +1315,17 @@ function dispatchPointerUp(a, inputState
  *     Promise to dispatch at least one pointermove event, as well as
  *     mousemove events as appropriate.
  */
 function dispatchPointerMove(a, inputState, tickDuration, window) {
   const timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   // interval between pointermove increments in ms, based on common vsync
   const fps60 = 17;
 
-  return new Promise(resolve => {
+  return new Promise((resolve, reject) => {
     const start = Date.now();
     const [startX, startY] = [inputState.x, inputState.y];
 
     let coords = getElementCenter(a.origin, window);
     let target = action.computePointerDestination(a, inputState, coords);
     const [targetX, targetY] = [target.x, target.y];
 
     if (!inViewPort(targetX, targetY, window)) {
@@ -1365,18 +1365,19 @@ function dispatchPointerMove(a, inputSta
       }
     })();
 
     // perform last pointer move after all incremental moves are resolved and
     // durationRatio is close enough to 1
     intermediatePointerEvents.then(() => {
       performOnePointerMove(inputState, targetX, targetY, window);
       resolve();
+    }).catch(err => {
+      reject(err);
     });
-
   });
 }
 
 function performOnePointerMove(inputState, targetX, targetY, win) {
   if (targetX == inputState.x && targetY == inputState.y) {
     return;
   }