Wait for the pending candidate before updating the pointer

These tests mutate the media element while the resource selection algorithm is
parked on a candidate, then check which sources get processed. They did the
mutation from a script that runs during parsing. Per spec that is late enough:
"await a stable state" queues a microtask, and the parser performs a microtask
checkpoint at </script>, so the pointer is (b | c) with b pending by then.

No engine resumes there. Firefox Nightly, Chrome Canary and Safari TP all run
the synchronous section in a task, so the mutation landed before the algorithm
had started and the tests measured tree order rather than the pointer update
rules. Two of them failed for that reason alone
(pointer-insert-source and pointer-remove-source, on x1); the other four
happened to expect the same result under either timing, so they passed without
testing anything about the pointer.

Wait for video.currentSrc to become source b's URL instead. currentSrc is set in
the "process candidate" step, after the pointer has advanced and before the
resource fetch algorithm runs, so it directly observes the state these tests
need, under either timing. Polling is used rather than an event because no event
works: loadstart is queued before the mode-specific steps, and engines disagree
on whether a source's error task is dispatched before or after the pointer
advances. Each test also asserts that b is still pending at that point, so a
wrong sync point fails loudly instead of silently measuring something else.

pointer-remove-text.html additionally iterated a live childNodes while removing
from it, which skipped entries and only removed every text node by coincidence
of the alternating markup. Snapshot the list and assert the removal happened.

pointer-remove-source-after.html did its four removals in four separate
parse-time scripts, which under the new sync point collapse into one step.

Firefox Nightly now passes all six, including the two that failed before.
Chrome Canary and Safari TP still fail all six on "error events on c", which is
unrelated: both fail the unmodified pointer-control.html the same way, because a
source with no src that follows a failed src-bearing source never fires error.
6 files changed
tree: 5a27610e314cea90e4511243ddb1d4bc9c329b3b
  1. .github/
  2. .well-known/
  3. accelerometer/
  4. accessibility/
  5. accname/
  6. acid/
  7. ai/
  8. ambient-light/
  9. animation-worklet/
  10. annotation-model/
  11. annotation-protocol/
  12. annotation-vocab/
  13. apng/
  14. appmanifest/
  15. audio-output/
  16. audio-session/
  17. autoplay-policy-detection/
  18. avif/
  19. background-fetch/
  20. background-sync/
  21. badging/
  22. battery-status/
  23. beacon/
  24. bluetooth/
  25. captured-mouse-events/
  26. clear-site-data/
  27. client-hints/
  28. clipboard-apis/
  29. close-watcher/
  30. common/
  31. compat/
  32. compression/
  33. compute-pressure/
  34. conformance-checkers/
  35. connection-allowlist/
  36. console/
  37. contacts/
  38. container-timing/
  39. content-dpr/
  40. content-index/
  41. content-security-policy/
  42. contenteditable/
  43. cookies/
  44. cookiestore/
  45. core-aam/
  46. cors/
  47. cpu-performance/
  48. credential-management/
  49. css/
  50. cssom/
  51. custom-elements/
  52. delegated-ink/
  53. density-size-correction/
  54. deprecation-reporting/
  55. device-bound-session-credentials/
  56. device-memory/
  57. device-posture/
  58. digital-credentials/
  59. direct-sockets/
  60. docs/
  61. document-picture-in-picture/
  62. document-policy/
  63. dom/
  64. domparsing/
  65. domxpath/
  66. dpub-aam/
  67. dpub-aria/
  68. ecmascript/
  69. editing/
  70. element-timing/
  71. encoding/
  72. encoding-detection/
  73. encrypted-media/
  74. entries-api/
  75. event-timing/
  76. eventsource/
  77. eyedropper/
  78. fedcm/
  79. fenced-frame/
  80. fetch/
  81. file-system-access/
  82. FileAPI/
  83. focus/
  84. font-access/
  85. fonts/
  86. forced-colors-mode/
  87. fs/
  88. fullscreen/
  89. gamepad/
  90. generic-sensor/
  91. geolocation/
  92. geolocation-sensor/
  93. gif/
  94. gpc/
  95. graphics-aam/
  96. graphics-aria/
  97. gyroscope/
  98. hr-time/
  99. hsts/
  100. html/
  101. html-aam/
  102. html-longdesc/
  103. html-media-capture/
  104. html-ruby-extensions/
  105. https-upgrades/
  106. idle-detection/
  107. imagebitmap-renderingcontext/
  108. images/
  109. import-maps/
  110. IndexedDB/
  111. inert/
  112. infrastructure/
  113. input-device-capabilities/
  114. input-events/
  115. installedapp/
  116. interfaces/
  117. intersection-observer/
  118. intervention-reporting/
  119. is-input-pending/
  120. jpegxl/
  121. js/
  122. js-self-profiling/
  123. keyboard-lock/
  124. keyboard-map/
  125. largest-contentful-paint/
  126. layout-instability/
  127. loading/
  128. long-animation-frame/
  129. longtask-timing/
  130. magnetometer/
  131. managed/
  132. mathml/
  133. measure-memory/
  134. media/
  135. media-capabilities/
  136. media-playback-quality/
  137. media-source/
  138. mediacapture-extensions/
  139. mediacapture-fromelement/
  140. mediacapture-handle/
  141. mediacapture-image/
  142. mediacapture-insertable-streams/
  143. mediacapture-record/
  144. mediacapture-region/
  145. mediacapture-streams/
  146. mediasession/
  147. merchant-validation/
  148. mimesniff/
  149. mixed-content/
  150. mst-content-hint/
  151. nav-tracking-mitigations/
  152. navigation-api/
  153. navigation-timing/
  154. netinfo/
  155. network-error-logging/
  156. notifications/
  157. old-tests/
  158. orientation-event/
  159. orientation-sensor/
  160. page-lifecycle/
  161. page-visibility/
  162. paint-timing/
  163. payment-method-basic-card/
  164. payment-method-id/
  165. payment-method-manifest/
  166. payment-request/
  167. performance-timeline/
  168. periodic-background-sync/
  169. permissions/
  170. permissions-policy/
  171. permissions-request/
  172. permissions-revoke/
  173. picture-in-picture/
  174. png/
  175. pointerevents/
  176. pointerlock/
  177. preload/
  178. presentation-api/
  179. print/
  180. private-click-measurement/
  181. proximity/
  182. push-api/
  183. quirks/
  184. referrer-policy/
  185. remote-playback/
  186. reporting/
  187. requestidlecallback/
  188. resize-observer/
  189. resource-timing/
  190. resources/
  191. sanitizer-api/
  192. savedata/
  193. scheduler/
  194. screen-capture/
  195. screen-details/
  196. screen-orientation/
  197. screen-wake-lock/
  198. scroll-animations/
  199. scroll-performance-timing/
  200. scroll-to-text-fragment/
  201. secure-contexts/
  202. secure-payment-confirmation/
  203. selection/
  204. serial/
  205. server-timing/
  206. service-workers/
  207. shadow-dom/
  208. shape-detection/
  209. signed-exchange/
  210. soft-navigation-heuristics/
  211. speculation-rules/
  212. speech-api/
  213. storage/
  214. storage-access-api/
  215. streams/
  216. subapps/
  217. subresource-integrity/
  218. svg/
  219. svg-aam/
  220. third_party/
  221. timing-entrytypes-registry/
  222. tools/
  223. top-level-storage-access-api/
  224. touch-events/
  225. trust-tokens/
  226. trusted-types/
  227. ua-client-hints/
  228. uievents/
  229. upgrade-insecure-requests/
  230. url/
  231. urlpattern/
  232. user-timing/
  233. vibration/
  234. video-rvfc/
  235. viewport/
  236. viewport-segments/
  237. virtual-keyboard/
  238. visual-viewport/
  239. wai-aria/
  240. wasm/
  241. web-animations/
  242. web-based-payment-handler/
  243. web-bundle/
  244. web-extensions/
  245. web-install/
  246. web-locks/
  247. web-nfc/
  248. web-otp/
  249. web-share/
  250. webaudio/
  251. webauthn/
  252. webcodecs/
  253. WebCryptoAPI/
  254. webdriver/
  255. webgl/
  256. webgpu/
  257. webhid/
  258. webidl/
  259. webmcp/
  260. webmessaging/
  261. webmidi/
  262. webnn/
  263. webrtc/
  264. webrtc-encoded-transform/
  265. webrtc-extensions/
  266. webrtc-ice/
  267. webrtc-identity/
  268. webrtc-priority/
  269. webrtc-stats/
  270. webrtc-svc/
  271. websockets/
  272. webstorage/
  273. webtransport/
  274. webusb/
  275. webvtt/
  276. webxr/
  277. window-management/
  278. workers/
  279. worklets/
  280. x-frame-options/
  281. xhr/
  282. xml/
  283. .azure-pipelines.yml
  284. .gitattributes
  285. .gitignore
  286. .mailmap
  287. .python-version
  288. .taskcluster.yml
  289. CODE_OF_CONDUCT.md
  290. CODEOWNERS
  291. CONTRIBUTING.md
  292. LICENSE.md
  293. lint.ignore
  294. README.md
  295. wpt
  296. 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.

AI Policy

Use of LLMs to help author tests is generally acceptable, but every change must be attributable to a human who understands and can take responsibility for the proposed change.

Use of LLMs to participate in discussions is generally not acceptable; any LLM-generated content must either be from a bot account or contained inside a <blockquote> (for short contributions of at most one paragraph) or <details> element.

For full details see the Policy for LLM Use

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!