[Gecko Bug 1686666] Make marionette events use EventUtil.js directly #32989
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rather than copying over the code from EventUtils, load EventUtils.js
into event.js. This is slightly complicated by the fact that
EventUtils.js depends on the existence of a global named
window
. Soinstead of loading the script as a normal component, we need to use
loadSubScript
to create an instance of the script with the requiredwindow binding (this is similar to the approach the CDP module uses).
The actual API changes for mouse events are ~trivial, but for key
events things are a little more involved. The code previously (in
effect) called synthesizeKey with the virtual keycode as the aKey
argument. However EventUtils.js documents this as deprecated, so we
switch to providing the actual key, with the
KEY_
prefix fornon-printable characters.
To make this easier, all the data about various keys from the
WebDriver spec is collapsed into a single lookup table, rather than
having a table for each interesting property.
Differential Revision: https://phabricator.services.mozilla.com/D138449
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1686666
gecko-commit: b609cc1c05e7108ed02ed97d037bc581b47cfa29
gecko-reviewers: webdriver-reviewers, whimboo