[whatwg/xhr] Only let upload listeners matter for asynchronous requests with a body (PR #416)

Synchronous requests do not dispatch upload events and requests without a body have nothing to upload. Registered upload event listeners therefore no longer cause a CORS-preflight request in those cases. This aligns with Chromium.

This also stops upload events from being dispatched for requests without a body, which addresses part of #242.

Tests: https://github.com/web-platform-tests/wpt/pull/65966.

Fixes #415.

- [x] At least two implementers are interested (and none opposed):
   * WebKit
   * Chromium (already implements this)
- [x] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
   * https://github.com/web-platform-tests/wpt/pull/65966
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
   * Chromium: N/A (already matches)
   * Gecko: …
   * WebKit: …
   * Servo: …
- [ ] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: …
- [x] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use.

(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)

A Fetch note is updated in https://github.com/whatwg/fetch/pull/1983.


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://whatpr.org/xhr/416.html" title="Last updated on Dec 1, 2026, 2:50 PM UTC (df1bf26)">Preview</a> | <a href="https://whatpr.org/xhr/416/c3476b4...df1bf26.html" title="Last updated on Dec 1, 2026, 2:50 PM UTC (df1bf26)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/xhr/pull/416

-- Commit Summary --

  * Only let upload listeners matter for asynchronous requests with a body

-- File Changes --

    M xhr.bs (12)

-- Patch Links --

https://github.com/whatwg/xhr/pull/416.patch
https://github.com/whatwg/xhr/pull/416.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/xhr/pull/416
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/xhr/pull/416@github.com>

Received on Tuesday, 1 December 2026 14:51:18 UTC