[Gecko Bug 1592781] use promise_test() to schedule TaskRunner Tasks (#20610)

promise_test() provides that a subtest is generated for each Task and run even
when an exception is thrown while running a previous Task.

This change also provides that Tasks that do not complete are reported
TIMEOUT, andTasks that are not reached due to TIMEOUT in a previous test
are reported NOTRUN.

The previous logic in Task.run() to generate a subtest for reporting a PASS
after calling _taskFunction() had a flaw that calls to done() during
_taskFunction() would synchronously call _testharnessDone() before the subtest
was generated.

Differential Revision: https://phabricator.services.mozilla.com/D51563

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1592781
gecko-commit: 195a6104b5fdd7b3f9d04d1ce8e0e86bdbb29869
gecko-integration-branch: central
gecko-reviewers: jgraham

* catch unhandled rejections in async TaskRunner Tasks

Unhandled rejections are then reported against the appropriate subtest.

Differential Revision: https://phabricator.services.mozilla.com/D51564

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1592781
gecko-commit: 98ce0aadba7a30c5ca695468bf8561d1c911b038
gecko-integration-branch: central
gecko-reviewers: jgraham

* use existing promise test instead of separate subtest for step_timeout()

Depends on D51564

Differential Revision: https://phabricator.services.mozilla.com/D51565

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1592781
gecko-commit: 2d26bfe54d3fabcd4aabe257cbf9bb5c1cf9fd27
gecko-integration-branch: central
gecko-reviewers: jgraham

* assert that task.done() is called once only

Depends on D51565

Differential Revision: https://phabricator.services.mozilla.com/D51566

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1592781
gecko-commit: 4f9bb3fd99208bbf178a0e2623faaf05eee18a02
gecko-integration-branch: central
gecko-reviewers: jgraham

* auto-finish TaskRunner Tasks created from async functions

Differential Revision: https://phabricator.services.mozilla.com/D51567

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1592781
gecko-commit: 8ac99aff562c3065c7ad806e4ee54f1f85134668
gecko-integration-branch: central
gecko-reviewers: jgraham

* remove now-unused _logException()

as in https://hg.mozilla.org/mozilla-central/rev/195a6104b5fd#l9.2

When the Gecko changeset was merged for a wpt PR in
31759598c118f71bdb54cc72a80b484f58e36d8c there was no _logException() function
to remove, as this was added in f3ef5f04bd2bb18ce426ef703f066aaa1078e492.
2 files changed
tree: 0b3463fa612bfd82b2d27e275d9f0eb028b7bafa
  1. .github/
  2. .well-known/
  3. 2dcontext/
  4. accelerometer/
  5. accname/
  6. acid/
  7. ambient-light/
  8. animation-worklet/
  9. annotation-model/
  10. annotation-protocol/
  11. annotation-vocab/
  12. apng/
  13. appmanifest/
  14. audio-output/
  15. background-fetch/
  16. BackgroundSync/
  17. battery-status/
  18. beacon/
  19. bluetooth/
  20. clear-site-data/
  21. client-hints/
  22. clipboard-apis/
  23. common/
  24. compat/
  25. compression/
  26. conformance-checkers/
  27. console/
  28. contacts/
  29. content-dpr/
  30. content-security-policy/
  31. cookie-store/
  32. cookies/
  33. core-aam/
  34. cors/
  35. credential-management/
  36. css/
  37. custom-elements/
  38. device-memory/
  39. docs/
  40. document-policy/
  41. dom/
  42. domparsing/
  43. domxpath/
  44. dpub-aam/
  45. dpub-aria/
  46. editing/
  47. element-timing/
  48. encoding/
  49. encrypted-media/
  50. entries-api/
  51. event-timing/
  52. eventsource/
  53. feature-policy/
  54. fetch/
  55. FileAPI/
  56. fonts/
  57. forced-colors-mode/
  58. fullscreen/
  59. gamepad/
  60. generic-sensor/
  61. geolocation-API/
  62. geolocation-sensor/
  63. graphics-aam/
  64. gyroscope/
  65. hr-time/
  66. html/
  67. html-longdesc/
  68. html-media-capture/
  69. idle-detection/
  70. imagebitmap-renderingcontext/
  71. images/
  72. import-maps/
  73. IndexedDB/
  74. inert/
  75. infrastructure/
  76. input-device-capabilities/
  77. input-events/
  78. installedapp/
  79. interfaces/
  80. intersection-observer/
  81. js/
  82. keyboard-lock/
  83. keyboard-map/
  84. kv-storage/
  85. largest-contentful-paint/
  86. layout-instability/
  87. lifecycle/
  88. loading/
  89. longtask-timing/
  90. magnetometer/
  91. mathml/
  92. measure-memory/
  93. media/
  94. media-capabilities/
  95. media-playback-quality/
  96. media-source/
  97. mediacapture-depth/
  98. mediacapture-fromelement/
  99. mediacapture-image/
  100. mediacapture-record/
  101. mediacapture-streams/
  102. mediasession/
  103. mimesniff/
  104. mixed-content/
  105. mst-content-hint/
  106. native-file-system/
  107. navigation-timing/
  108. netinfo/
  109. network-error-logging/
  110. notifications/
  111. offscreen-canvas/
  112. old-tests/
  113. orientation-event/
  114. orientation-sensor/
  115. origin-policy/
  116. page-visibility/
  117. paint-timing/
  118. payment-handler/
  119. payment-method-basic-card/
  120. payment-method-id/
  121. payment-request/
  122. performance-timeline/
  123. PeriodicBackgroundSync/
  124. permissions/
  125. picture-in-picture/
  126. pointerevents/
  127. pointerlock/
  128. portals/
  129. preload/
  130. presentation-api/
  131. printing/
  132. priority-hints/
  133. proximity/
  134. push-api/
  135. quirks/
  136. referrer-policy/
  137. remote-playback/
  138. reporting/
  139. requestidlecallback/
  140. resize-observer/
  141. resource-timing/
  142. resources/
  143. screen-capture/
  144. screen-orientation/
  145. screen_enumeration/
  146. scroll-animations/
  147. scroll-to-text-fragment/
  148. secure-contexts/
  149. selection/
  150. serial/
  151. server-timing/
  152. service-workers/
  153. shadow-dom/
  154. shape-detection/
  155. signed-exchange/
  156. sms/
  157. speech-api/
  158. std-toast/
  159. storage/
  160. storage-access-api/
  161. streams/
  162. subresource-integrity/
  163. svg/
  164. svg-aam/
  165. timing-entrytypes-registry/
  166. tools/
  167. touch-events/
  168. trusted-types/
  169. uievents/
  170. upgrade-insecure-requests/
  171. url/
  172. user-timing/
  173. vibration/
  174. visual-viewport/
  175. wai-aria/
  176. wake-lock/
  177. wasm/
  178. web-animations/
  179. web-locks/
  180. web-nfc/
  181. web-share/
  182. webaudio/
  183. webauthn/
  184. WebCryptoAPI/
  185. webdriver/
  186. webgl/
  187. webgpu/
  188. WebIDL/
  189. webmessaging/
  190. webmidi/
  191. webrtc/
  192. webrtc-extensions/
  193. webrtc-identity/
  194. webrtc-quic/
  195. webrtc-stats/
  196. webrtc-svc/
  197. websockets/
  198. webstorage/
  199. webusb/
  200. webvr/
  201. webvtt/
  202. webxr/
  203. workers/
  204. worklets/
  205. x-frame-options/
  206. xhr/
  207. xslt/
  208. .azure-pipelines.yml
  209. .codecov.yml
  210. .gitattributes
  211. .gitignore
  212. .mailmap
  213. .pyup.yml
  214. .taskcluster.yml
  215. CODEOWNERS
  216. CONTRIBUTING.md
  217. LICENSE.md
  218. lint.whitelist
  219. README.md
  220. testharness_runner.html
  221. update-built-tests.sh
  222. wpt
  223. wpt.py
README.md

The web-platform-tests Project

Taskcluster CI Status

The web-platform-tests Project is a W3C-coordinated attempt to build 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 IRC chat room named #testing on irc.w3.org; includes participants located around the world, but busiest during the European working day; all discussion is archived here
  • Mailing list: a public and low-traffic discussion list

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.

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 http://w3c-test.org/.

Pull requests are automatically mirrored except those that modify sensitive resources (such as .py). The latter require someone with merge access to comment with “LGTM” or “w3c-test:mirror” to indicate the pull request has been checked.

Branches

In the vast majority of cases the only upstream branch that you should need to care about is master. If you see other branches in the repository, you can generally safely ignore them.

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!