From 169060002b599e87ab99094e4cfa4be349aeec91 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 25 Sep 2026 13:13:46 +0200 Subject: [PATCH] Use Fetch's multipart/form-data serializer Form submission now uses Fetch's multipart/form-data chunk serializer, replacing the multipart/form-data encoding algorithm and boundary string defined here. Tests: https://github.com/web-platform-tests/wpt/pull/59216 Fetch PR: https://github.com/whatwg/fetch/pull/1922 --- source | 87 ++++++++-------------------------------------------------- 1 file changed, 11 insertions(+), 76 deletions(-) diff --git a/source b/source index 4a5582ce8cb..51876d6d3a2 100644 --- a/source +++ b/source @@ -2296,7 +2296,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • ASCII alpha
  • ASCII alphanumeric
  • isomorphic decode
  • -
  • isomorphic encode
  • ASCII lowercase
  • ASCII uppercase
  • ASCII case-insensitive
  • @@ -2670,6 +2669,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • header list
  • set
  • get, decode, and split
  • +
  • the multipart/form-data chunk serializer
  • abort
  • cross-origin resource policy check
  • the RequestCredentials enumeration
  • @@ -64741,15 +64741,15 @@ fur
    multipart/form-data
    -

    Let body be the result of running the multipart/form-data encoding algorithm with entry list +

    Let (boundary, chunks) be the result of running the multipart/form-data chunk serializer with entry list and encoding.

    -

    Let mimeType be the isomorphic - encoding of the concatenation of "multipart/form-data; boundary=" and the multipart/form-data boundary string generated by the multipart/form-data encoding algorithm.

    +

    Let body be the concatenation of chunks, with each + File object in chunks replaced by the bytes it represents.

    + +

    Let mimeType be `multipart/form-data; boundary=`, + followed by boundary.

    text/plain
    @@ -65184,74 +65184,9 @@ fur
    Multipart form data
    -
    - - - - - -
    -

    The multipart/form-data encoding algorithm, given an entry - list entry list and an encoding encoding, is as - follows:

    - -
      -
    1. -

      For each entry of entry list:

      - -
        -
      1. Replace every occurrence of U+000D (CR) not followed by U+000A (LF), and every - occurrence of U+000A (LF) not preceded by U+000D (CR), in entry's name, by a string consisting of a U+000D (CR) and U+000A (LF).

      2. - -
      3. If entry's value is not a - File object, then replace every occurrence of U+000D (CR) not followed by U+000A - (LF), and every occurrence of U+000A (LF) not preceded by U+000D (CR), in entry's - value, by a string consisting of a U+000D (CR) and - U+000A (LF).

      4. -
      -
    2. - -
    3. -

      Return the byte sequence resulting from encoding the entry list using the rules - described by RFC 7578, Returning Values from Forms: multipart/form-data, given the following conditions: - RFC7578

      - -
        -
      • Each entry in entry list is a field, - the name of the entry is the field name and the - value of the entry is the field value.

      • - -
      • The order of parts must be the same as the order of fields in entry list. - Multiple entries with the same name must be treated as distinct fields.

      • - -
      • Field names, field values for non-file fields, and filenames for file fields, in the - generated multipart/form-data resource must be set to the result of encoding the corresponding entry's name or value with - encoding, converted to a byte sequence.

      • - -
      • For field names and filenames for file fields, the result of the encoding in the - previous bullet point must be escaped by replacing any 0x0A (LF) bytes with the byte sequence - `%0A`, 0x0D (CR) with `%0D` and 0x22 (") with - `%22`. The user agent must not perform any other escapes.

      • - -
      • The parts of the generated multipart/form-data resource that correspond to - non-file fields must not have a `Content-Type` header specified.

      • - -
      • The boundary used by the user agent in generating the return value of this algorithm is - the multipart/form-data boundary string. (This value is used to - generate the MIME type of the form submission payload generated by this algorithm.)

      • -
      -
    4. -
    -
    - -
    - -

    For details on how to interpret multipart/form-data payloads, see RFC 7578. - RFC7578

    +

    See Fetch for details on + multipart/form-data. FETCH

    Plain text form data