--- 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.