replace ReferrerInfo::IsCrossOriginRequest with nsScriptSecurityManager::CheckSameOriginURI for determining cross-origin redirects.

Since Bug 1802086, we strip authentication headers when redirected to a cross-origin page. However, the api   ReferrerInfo::IsCrossOriginRequest  used for determining whether a request is cross-origin cannot be used as it compares the triggering principal's uri with the redirected channel's uri. This comparison might sometimes yield to false positives.
For e.g consider the following scenario:
1. Load `https://example.org/` and send the following fetch request from browser console
```
fetch("https://test.com/some_location", {
  "headers": {
    "Authorization": "Token foo"
  }
});
```
2. Server responds with  a redirect to https://test.com/another_location

In the above scenario, the api ReferrerInfo::IsCrossOriginRequest  will yield the above request as cross origin since the triggering principal uri here is example.com. Hence, this will be treated as cross-origin redirect resulting in removal of auth headers.

Thus ReferrerInfo::IsCrossOriginRequest  has been replaced with nsScriptSecurityManager::CheckSameOriginURI  where we directly compare the origins for the two requests.

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1817980
gecko-commit: daf70dc1a75ac02f50c49e960a2aad8eca8adace
gecko-reviewers: necko-reviewers, valentin
1 file changed
tree: 559344cbd95d2403eb82e47f65c9d77d5ad8a412
  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. long-animation-frame/
  114. longtask-timing/
  115. magnetometer/
  116. managed/
  117. mathml/
  118. measure-memory/
  119. media/
  120. media-capabilities/
  121. media-playback-quality/
  122. media-source/
  123. mediacapture-extensions/
  124. mediacapture-fromelement/
  125. mediacapture-handle/
  126. mediacapture-image/
  127. mediacapture-insertable-streams/
  128. mediacapture-record/
  129. mediacapture-region/
  130. mediacapture-streams/
  131. mediasession/
  132. merchant-validation/
  133. mimesniff/
  134. mixed-content/
  135. mst-content-hint/
  136. navigation-api/
  137. navigation-timing/
  138. netinfo/
  139. network-error-logging/
  140. notifications/
  141. old-tests/
  142. orientation-event/
  143. orientation-sensor/
  144. page-lifecycle/
  145. page-visibility/
  146. paint-timing/
  147. parakeet/
  148. payment-handler/
  149. payment-method-basic-card/
  150. payment-method-id/
  151. payment-request/
  152. pending-beacon/
  153. performance-timeline/
  154. periodic-background-sync/
  155. permissions/
  156. permissions-policy/
  157. permissions-request/
  158. permissions-revoke/
  159. picture-in-picture/
  160. pointerevents/
  161. pointerlock/
  162. portals/
  163. preload/
  164. presentation-api/
  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!