fixups draft
authorMaja Frydrychowicz <mjzffr@gmail.com>
Tue, 06 Jun 2017 14:19:47 -0400
changeset 589749 604b78dff14cac7e4db5a10eb93ff2af2f65da02
parent 589748 16f44c3ecf0bccc7100374e216830842393dabf2
child 631993 5bb2bc677d0541c4eb5f4d6e63b68fc7cd66a54f
push id62492
push userbmo:mjzffr@gmail.com
push dateTue, 06 Jun 2017 18:23:19 +0000
milestone55.0a1
fixups MozReview-Commit-ID: GDjYI6rriGB
testing/marionette/action.js
--- a/testing/marionette/action.js
+++ b/testing/marionette/action.js
@@ -893,38 +893,36 @@ action.Key = class {
 
 /** Collect properties associated with MouseEvent */
 action.Mouse = class {
   constructor(type, button = 0) {
     this.type = type;
     assert.positiveInteger(button);
     this.button = button;
     this.buttons = 0;
-    this.updateModifiers();
+    this.altKey = false;
+    this.shiftKey = false;
+    this.metaKey = false;
+    this.ctrlKey = false;
+    // set modifier properties based on whether any corresponding keys are
+    // pressed on any key input source
+    for (let inputState of action.inputStateMap.values()) {
+      if (inputState.type == "key") {
+        this.altKey = inputState.alt || this.altKey;
+        this.ctrlKey = inputState.ctrl || this.ctrlKey;
+        this.metaKey = inputState.meta || this.metaKey;
+        this.shiftKey = inputState.shift || this.shiftKey;
+      }
+    }
   }
 
   update(inputState) {
     let allButtons = Array.from(inputState.pressed);
     this.buttons = allButtons.reduce((a, i) => a + Math.pow(2, i), 0);
   }
-
-  updateModifiers() {
-    this.altKey = false;
-    this.shiftKey = false;
-    this.metaKey = false;
-    this.ctrlKey = false;
-    for (var inputState of action.inputStateMap.values()) {
-      if (inputState.type == "key") {
-          this.altKey = inputState.alt || this.altKey;
-          this.ctrlKey = inputState.ctrl || this.ctrlKey;
-          this.metaKey = inputState.meta || this.metaKey;
-          this.shiftKey = inputState.shift || this.shiftKey;
-      }
-    }
-  }
 };
 
 /**
  * Dispatch a chain of actions over |chain.length| ticks.
  *
  * This is done by creating a Promise for each tick that resolves once all the
  * Promises for individual tick-actions are resolved. The next tick's actions are
  * not dispatched until the Promise for the current tick is resolved.