Closed Bug 2081470 Opened 1 month ago Closed 1 month ago

Implement the headers option of the WebTransport constructor

Categories

(Core :: Networking, task, P2)

task

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: jesup, Assigned: jesup)

References

(Depends on 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [necko-triaged])

Attachments

(1 external file)

The WebTransport spec added a headers member to WebTransportOptions (w3c/webtransport PR 713, merged 2026-02-25, fixing issue 263), so pages can add headers to the CONNECT request. Firefox does not implement it: WebTransportOptions in WebTransport.webidl has no headers member, so the option is silently ignored.

Spec requirements (WebTransport constructor, steps 30-33):

  • headers is a HeadersInit, defaulting to {}. It is converted to a Headers object, so invalid names or values throw a TypeError.
  • If the ASCII-lowercased name of any header is wt-available-protocols, throw a TypeError.
  • Headers are appended to the request through a Headers object with the "request" guard, so Fetch's forbidden request-header names (for example Cookie, Host, Referer, Sec-Fetch-*) are dropped silently rather than throwing.
  • If protocols is non-empty, WT-Available-Protocols is set afterwards from protocols, so it can only be sent that way.

Gecko currently builds the CONNECT request in WebTransportSessionProxy, where protocols is turned into wt-available-protocols through SetRequestHeader(). The new option needs:

  • the headers member in WebTransportOptions, with validation in WebTransport::Constructor (TypeError cases and the forbidden-name filtering);
  • a way to carry the resulting header list to the parent process (a new argument on the PWebTransport constructor message, WebTransportParent, and nsIWebTransport.asyncConnect);
  • setting those headers on the channel in WebTransportSessionProxy, before wt-available-protocols.

The headers must also reach the server over HTTP/2 as well as HTTP/3, in lowercase.

Tests: webtransport/headers.https.any.js already covers this.

Depends on: 2081488

Add headers to WebTransportOptions. It is filled into a Headers object, wt-available-protocols is rejected with a TypeError, and the rest goes through a request-guard Headers so forbidden request-header names are dropped silently. The resulting list travels to the parent over CreateWebTransportParent and is set on the CONNECT channel before wt-available-protocols. The parent applies the same restrictions again since the content process is not trusted.

Remove the now-passing expectations from headers.https.any.js.ini.

Assignee: nobody → rjesup
Status: NEW → ASSIGNED
Severity: -- → N/A
Priority: -- → P2
Whiteboard: [necko-triaged]
Depends on: 2081884
Pushed by rjesup@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/af45bd50e11c https://hg.mozilla.org/integration/autoland/rev/fe5d702d2714 implement the WebTransport headers option r=dom-core-reviewers,necko-reviewers,ipc-reviewers,webidl,hsivonen,saschanaz,valentin
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
Keywords: dev-doc-needed
QA Whiteboard: [qa-triage-done-c161/b160]

FF160 MDN work for this can be tracked in https://github.com/mdn/content/issues/46284

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: