[Private Network Access] Do not enforce preflights in http tests

The PNA for workers feature are currently in warning only mode, which
means that HTTP requests are not blocked, and the following test cases
that asserts failures in worker-fetch.window.js and
shared-worker-fetch.window.js should not pass:
not pass:
- private to local: failure
- public to local: failure
- public to private: failure
- treat-as-public to local: failure
- treat-as-public to private: failure

However, some of these test cases currently pass (meaning fetches
failed) because these test cases incorrectly specifies their
PreflightBehavior as `success`. In this mode, the test server
preflights.py would return 405 when it did not see a preflights before
the final request, failing the requests when it shouldn't.

This CL adds a mode `optionalSuccess`, which would respond to a
preflight if it sees one, but doesn't fail the final request if there
isn't a preflight. This allows us to make sure that the requests do fail
even if the server responds to preflights.

The above applies to virtual/pna-workers-disabled and virtual/plz-dedicated-workers as well.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/fetch/private-network-access/resources/support.sub.js;l=173-175;drc=416bc691f0aab3a1f344b673df60a00b26cd482a;bpv=1;bpt=0

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