Open Bug 2051477 Opened 1 month ago Updated 1 month ago

Align WebTransport datagrams-writable algorithm state with the spec's internal-slot model

Categories

(Core :: Networking, task, P3)

task

Tracking

()

People

(Reporter: jesup, Assigned: jesup)

References

Details

(Whiteboard: [necko-triaged])

Follow-up from review of D286306 (Bug 2007165). In the WebTransport spec, the datagrams writable's algorithms are stateless actions that read internal slots on the stream object itself ([[SendGroup]], [[SendOrder]], [[OutgoingDatagramsQueue]]). Our implementation instead models them as a refcounted OutgoingDatagramStreamAlgorithms object that carries its own copy of that state, which diverges from the spec and duplicates state across two objects.

Current shape (dom/webtransport/api/WebTransportDatagramsWritable.{h,cpp},
dom/webtransport/api/WebTransportDatagramDuplexStream.h):

  • WebTransportDatagramsWritable holds mSendGroup / mSendOrder, and keeps a
    separate mAlgorithms back-pointer to the OutgoingDatagramStreamAlgorithms.
  • OutgoingDatagramStreamAlgorithms independently owns mSendGroup, mSendOrder,
    mChild, mDatagrams, and mPendingDatagramPromises.
  • SetSendGroup / SetSendOrder write the stream's members and forward to the
    algorithms object's copies, keeping two sources of truth in sync by hand.

Desired shape (spec-aligned):

  • Move the per-writable state (sendGroup, sendOrder, child, outgoing-datagram queue, pending-datagram promise map) to live only on WebTransportDatagramsWritable, mirroring the spec's stream internal slots.
  • Make OutgoingDatagramStreamAlgorithms stateless: its writeDatagrams action reads those slots from the stream it was created for.
  • Drop the redundant mAlgorithms member (the WritableStreamDefaultController already owns the algorithms; reach them via Controller()->GetAlgorithms() only where needed - see comment 2 on D286306).
  • Collapse SetSendGroup / SetSendOrder to a single slot write, removing the hand-maintained forwarding.

No observable behavior change; makes the code track the spec algorithm structure and removes the state duplication.

Severity: -- → N/A
Priority: -- → P3
Whiteboard: [necko-triaged]
You need to log in before you can comment on or make changes to this bug.