Make marionette events use EventUtil.js directly

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`. So
instead of loading the script as a normal component, we need to use
`loadSubScript` to create an instance of the script with the required
window 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 for
non-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
1 file changed
tree: dc168a6a14eac087fd6f4119e4b197382d024a64
  1. .github/
  2. .well-known/
  3. accelerometer/
  4. accessibility/
  5. accname/
  6. acid/
  7. ambient-light/
  8. animation-worklet/
  9. annotation-model/
  10. annotation-protocol/
  11. annotation-vocab/
  12. apng/
  13. app-history/
  14. appmanifest/
  15. audio-output/
  16. background-fetch/
  17. BackgroundSync/
  18. badging/
  19. battery-status/
  20. beacon/
  21. bluetooth/
  22. clear-site-data/
  23. client-hints/
  24. clipboard-apis/
  25. common/
  26. compat/
  27. compression/
  28. compute-pressure/
  29. conformance-checkers/
  30. console/
  31. contacts/
  32. content-dpr/
  33. content-index/
  34. content-security-policy/
  35. contenteditable/
  36. cookie-store/
  37. cookies/
  38. core-aam/
  39. cors/
  40. credential-management/
  41. css/
  42. custom-elements/
  43. custom-state-pseudo-class/
  44. delegated-ink/
  45. density-size-correction/
  46. deprecation-reporting/
  47. device-memory/
  48. direct-sockets/
  49. docs/
  50. document-policy/
  51. dom/
  52. domparsing/
  53. domxpath/
  54. dpub-aam/
  55. dpub-aria/
  56. editing/
  57. element-timing/
  58. encoding/
  59. encoding-detection/
  60. encrypted-media/
  61. entries-api/
  62. event-timing/
  63. eventsource/
  64. eyedropper/
  65. feature-policy/
  66. fetch/
  67. file-system-access/
  68. FileAPI/
  69. focus/
  70. font-access/
  71. fonts/
  72. forced-colors-mode/
  73. fullscreen/
  74. gamepad/
  75. generic-sensor/
  76. geolocation-API/
  77. geolocation-sensor/
  78. graphics-aam/
  79. gyroscope/
  80. hr-time/
  81. html/
  82. html-longdesc/
  83. html-media-capture/
  84. idle-detection/
  85. imagebitmap-renderingcontext/
  86. images/
  87. import-maps/
  88. IndexedDB/
  89. inert/
  90. infrastructure/
  91. input-device-capabilities/
  92. input-events/
  93. installedapp/
  94. interfaces/
  95. intersection-observer/
  96. intervention-reporting/
  97. is-input-pending/
  98. js/
  99. js-self-profiling/
  100. keyboard-lock/
  101. keyboard-map/
  102. largest-contentful-paint/
  103. layout-instability/
  104. lifecycle/
  105. loading/
  106. longtask-timing/
  107. magnetometer/
  108. managed/
  109. mathml/
  110. measure-memory/
  111. media/
  112. media-capabilities/
  113. media-playback-quality/
  114. media-source/
  115. mediacapture-fromelement/
  116. mediacapture-image/
  117. mediacapture-insertable-streams/
  118. mediacapture-record/
  119. mediacapture-region/
  120. mediacapture-streams/
  121. mediasession/
  122. merchant-validation/
  123. mimesniff/
  124. mixed-content/
  125. mst-content-hint/
  126. native-io/
  127. navigation-timing/
  128. netinfo/
  129. network-error-logging/
  130. notifications/
  131. old-tests/
  132. orientation-event/
  133. orientation-sensor/
  134. origin-policy/
  135. page-lifecycle/
  136. page-visibility/
  137. paint-timing/
  138. parakeet/
  139. payment-handler/
  140. payment-method-basic-card/
  141. payment-method-id/
  142. payment-request/
  143. performance-timeline/
  144. periodic-background-sync/
  145. permissions/
  146. permissions-policy/
  147. permissions-request/
  148. permissions-revoke/
  149. picture-in-picture/
  150. pointerevents/
  151. pointerlock/
  152. portals/
  153. preload/
  154. presentation-api/
  155. priority-hints/
  156. private-click-measurement/
  157. proximity/
  158. push-api/
  159. quirks/
  160. referrer-policy/
  161. remote-playback/
  162. reporting/
  163. requestidlecallback/
  164. resize-observer/
  165. resource-timing/
  166. resources/
  167. sanitizer-api/
  168. savedata/
  169. scheduler/
  170. screen-capture/
  171. screen-details/
  172. screen-orientation/
  173. screen-wake-lock/
  174. scroll-animations/
  175. scroll-to-text-fragment/
  176. secure-contexts/
  177. secure-payment-confirmation/
  178. selection/
  179. serial/
  180. server-timing/
  181. service-workers/
  182. shadow-dom/
  183. shape-detection/
  184. signed-exchange/
  185. speculation-rules/
  186. speech-api/
  187. storage/
  188. storage-access-api/
  189. streams/
  190. subapps/
  191. subresource-integrity/
  192. svg/
  193. svg-aam/
  194. timing-entrytypes-registry/
  195. tools/
  196. touch-events/
  197. trust-tokens/
  198. trusted-types/
  199. ua-client-hints/
  200. uievents/
  201. upgrade-insecure-requests/
  202. url/
  203. urlpattern/
  204. user-timing/
  205. vibration/
  206. video-rvfc/
  207. virtual-keyboard/
  208. visual-viewport/
  209. wai-aria/
  210. wasm/
  211. web-animations/
  212. web-bundle/
  213. web-locks/
  214. web-nfc/
  215. web-otp/
  216. web-share/
  217. webaudio/
  218. webauthn/
  219. webcodecs/
  220. WebCryptoAPI/
  221. webdriver/
  222. webgl/
  223. webgpu/
  224. webhid/
  225. webidl/
  226. webmessaging/
  227. webmidi/
  228. webnn/
  229. webrtc/
  230. webrtc-encoded-transform/
  231. webrtc-extensions/
  232. webrtc-ice/
  233. webrtc-identity/
  234. webrtc-priority/
  235. webrtc-stats/
  236. webrtc-svc/
  237. websockets/
  238. webstorage/
  239. webtransport/
  240. webusb/
  241. webvr/
  242. webvtt/
  243. webxr/
  244. window-placement/
  245. workers/
  246. worklets/
  247. x-frame-options/
  248. xhr/
  249. .azure-pipelines.yml
  250. .gitattributes
  251. .gitignore
  252. .mailmap
  253. .taskcluster.yml
  254. CODE_OF_CONDUCT.md
  255. CODEOWNERS
  256. CONTRIBUTING.md
  257. LICENSE.md
  258. lint.ignore
  259. README.md
  260. testharness_runner.html
  261. wpt
  262. wpt.py
README.md

The web-platform-tests Project

Taskcluster CI Status documentation manifest Python 3

The web-platform-tests Project is a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.

The most important sources of information and activity are:

  • github.com/web-platform-tests/wpt: the canonical location of the project's source code revision history and the discussion forum for changes to the code
  • web-platform-tests.org: the documentation website; details how to set up the project, how to write tests, how to give and receive peer review, how to serve as an administrator, and more
  • wpt.live: a public deployment of the test suite, allowing anyone to run the tests by visiting from an Internet-enabled browser of their choice
  • wpt.fyi: an archive of test results collected from an array of web browsers on a regular basis
  • Real-time chat room: the wpt:matrix.org matrix channel; includes participants located around the world, but busiest during the European working day.
  • Mailing list: a public and low-traffic discussion list
  • RFCs: a repo for requesting comments on substantial changes that would impact other stakeholders or users; people who work on WPT infra are encouraged to watch the repo.

If you'd like clarification about anything, don't hesitate to ask in the chat room or on the mailing list.

Setting Up the Repo

Clone or otherwise get https://github.com/web-platform-tests/wpt.

Note: because of the frequent creation and deletion of branches in this repo, it is recommended to “prune” stale branches when fetching updates, i.e. use git pull --prune (or git fetch -p && git merge).

Running the Tests

See the documentation website and in particular the system setup for running tests locally.

Command Line Tools

The wpt command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are:

  • wpt serve - For starting the wpt http server
  • wpt run - For running tests in a browser
  • wpt lint - For running the lint against all tests
  • wpt manifest - For updating or generating a MANIFEST.json test manifest
  • wpt install - For installing the latest release of a browser or webdriver server on the local machine.
  • wpt serve-wave - For starting the wpt http server and the WAVE test runner. For more details on how to use the WAVE test runner see the documentation.

Windows Notes

On Windows wpt commands must be prefixed with python or the path to the python binary (if python is not in your %PATH%).

python wpt [command]

Alternatively, you may also use Bash on Ubuntu on Windows in the Windows 10 Anniversary Update build, then access your windows partition from there to launch wpt commands.

Please make sure git and your text editor do not automatically convert line endings, as it will cause lint errors. For git, please set git config core.autocrlf false in your working tree.

Publication

The master branch is automatically synced to wpt.live and w3c-test.org.

Contributing

Save the Web, Write Some Tests!

Absolutely everyone is welcome to contribute to test development. No test is too small or too simple, especially if it corresponds to something for which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

  • Fork this repository (and make sure you're still relatively in sync with it if you forked a while ago).
  • Create a branch for your changes: git checkout -b topic.
  • Make your changes.
  • Run ./wpt lint as described above.
  • Commit locally and push that to your repo.
  • Create a pull request based on the above.

Issues with web-platform-tests

If you spot an issue with a test and are not comfortable providing a pull request per above to fix it, please file a new issue. Thank you!