← Chrome 159 reference · All APIs

v159 · webtransport · in developer trial (behind a flag)

WebTransportError API alignment and serialization

Aligns Chromium’s WebTransportError with the W3C WebTransport specification by adding the standard new WebTransportError(message, options) constructor (while keeping Chromium’s legacy dictionary-only overload for compatibility), propagating full 32-bit unsigned long streamErrorCode values end-to-end without 8-bit truncation, and making WebTransportError [Serializable] for structuredClone(), postMessage(), and IndexedDB.

Limited availability — behind a flag in Chrome 159 (shipping target Chrome 160); base WebTransport is Baseline Newly available since 2026-03-24

  • Chrome · 159 behind flag (shipping target 160)
  • Edge · Chromium-based (not yet shipped)
  • Firefox · Shipped (Bug 2009530)
  • Safari · Shipped (WebKit Bug 305224 / 26.4)

While the base webtransport web-feature is Baseline Newly available (since 2026-03-24 per webstatus.dev) and BCD WebTransportError.json records base WebTransportError from Chrome 97, Firefox 114, and Safari 26.4, BCD does not yet separate the standard (message, options) constructor, 32-bit streamErrorCode, or [Serializable] support (checked 2026-11-24).

Developer trial (behind a flag) in Chrome 159 — shipping target Chrome 160.

In Chrome 159, this alignment is filed under In developer trial (Behind a flag); ChromeStatus 5158277221580800 targets shipping enabled by default in Chrome 160 (desktop, Android, Android WebView). To test in Chrome 159, enable chrome://flags/#enable-experimental-web-platform-features or launch Chrome with --enable-blink-features=WebTransportErrorSerialization. Once shipped, serialization writing remains controlled by the WebTransportErrorSerialization runtime kill switch while versioned decoding stays permanently enabled so persisted values remain readable.

at a glance

Status in Chrome 159In developer trial (Behind a flag) in Chrome 159 (desktop, Android); shipping enabled by default targeted for Chrome 160 (desktop, Android, Android WebView) per the milestone=159 listing and ChromeStatus API record
Flag / kill switchchrome://flags/#enable-experimental-web-platform-features or --enable-blink-features=WebTransportErrorSerialization (Finch / runtime feature WebTransportErrorSerialization in runtime_enabled_features.json5)
SpecificationW3C WebTransport §12 WebTransportError Interface; Protocol Mapping (32-bit error code)
Intentblink-dev Intent to Ship
Tracking bugissues.chromium.org/577073049
Web platform testswebtransport/idlharness.https.sub.any.html; WPT PR #63842
ChromeStatus5158277221580800 — WebTransportError API alignment and serialization

why it exists

Chromium’s original WebTransportError implementation (shipped in Chrome 97) predated three changes in the W3C WebTransport specification: it only exposed a legacy dictionary constructor (new WebTransportError({ message, streamErrorCode })) instead of the DOMException-aligned (message, options) signature; it narrowed outgoing application stream error codes to 8 bits (0–255) even though the attribute type was unsigned long?; and it lacked structured serialization support, causing worker-to-window error relays and IndexedDB error logs to fail or drop WebTransport metadata. Aligning Chromium with Firefox and Safari closes these interop gaps without breaking existing callers that pass a dictionary as the first argument.

Source: ChromeStatus motivation (5158277221580800); Interop 2026 WebTransport proposal (#1121).

Syntax

Verbatim Blink WebIDL (matching W3C WebTransport §12 plus Chromium’s retained legacy compatibility overload):

// third_party/blink/renderer/modules/webtransport/web_transport_error.idl
enum WebTransportErrorSource {
  "stream",
  "session",
};

[Exposed=(Window,Worker), Serializable, SecureContext]
interface WebTransportError : DOMException {
  // Standard W3C constructor
  constructor(optional DOMString message = "",
              optional WebTransportErrorOptions options = {});

  // Chromium legacy compatibility overload (clamps streamErrorCode to octet 0..255)
  [MeasureAs=WebTransportErrorLegacyConstructor]
  constructor(WebTransportErrorInit init, optional any legacyIgnored);

  readonly attribute unsigned long? streamErrorCode;
  readonly attribute WebTransportErrorSource source;
};

// third_party/blink/renderer/modules/webtransport/web_transport_error_options.idl
dictionary WebTransportErrorOptions {
  WebTransportErrorSource source = "stream";
  [Clamp] unsigned long? streamErrorCode = null;
};

// third_party/blink/renderer/modules/webtransport/web_transport_error_init.idl
dictionary WebTransportErrorInit {
  [Clamp] octet streamErrorCode;
  DOMString message;
};

This reference documents four parts of the contract: standard (message, options) constructor, legacy dictionary overload, 32-bit streamErrorCode and source, and [Serializable] structured cloning.

Source: W3C WebTransport §12; Blink web_transport_error.idl; Blink web_transport_error_options.idl; Blink web_transport_error_init.idl.

Standard constructor: new WebTransportError(message, options)

Inputs. Accepts two optional parameters matching the W3C specification:

Outputs. Returns a WebTransportError instance (subclass of DOMException) with name === "WebTransportError", legacy code === 0, and the requested message, source, and streamErrorCode.

Source: W3C WebTransport §12; Blink web_transport_error.cc; Blink web_transport_error_test.cc.

Legacy compatibility overload: new WebTransportError(init)

Inputs. When the first argument is a non-null JS object (matching WebIDL dictionary overload resolution for WebTransportErrorInit), Chromium dispatches to the retained legacy overload constructor(WebTransportErrorInit init, optional any legacyIgnored):

Outputs & migration note. Always produces source === "stream" and increments Chromium’s WebTransportErrorLegacyConstructor UseCounter. Firefox and Safari only implement the standard (message, options) signature — passing an object as the first argument there coerces it via ToString() to "[object Object]". New cross-browser code should always call new WebTransportError(message, options).

Source: Blink web_transport_error.idl; Blink web_transport_error.cc; ChromeStatus compatibility risks.

Full 32-bit streamErrorCode and source

Inputs & outputs. error.streamErrorCode is a read-only unsigned long? carrying the full 32-bit application stream error code (0 through 4294967295, or null when no application error code applies). Previously, Chromium truncated outgoing application stream error codes (for example when aborting a stream or calling ReadableStream.cancel() / WritableStream.abort() with a WebTransportError) to 8 bits (0–255). With this change, Chromium carries the full 32-bit uint32_t value end-to-end across HTTP/3 WebTransport stream reset/stop-sending protocol mapping. error.source is a read-only WebTransportErrorSource equal to "stream" (error originated on an individual stream or client abort) or "session" (session-level error).

Source: W3C WebTransport Protocol Mapping; ChromeStatus summary (5158277221580800); WPT PR #63842.

[Serializable] structured cloning

Inputs & outputs. Marking WebTransportError as [Serializable] allows instances to pass through structuredClone(), Worker.postMessage() / MessageChannel, and IndexedDB storage. Blink’s module serializer (V8ScriptValueSerializerForModules::WriteDOMObject) writes a dedicated versioned tag (kWebTransportErrorTag) carrying four fields before delegating to the core DOMException serializer:

Fields preserved by WebTransportError structured serialization in Chromium
FieldPreserved?Details
Prototype / subtypeYesDeserializes as WebTransportError (cloned instanceof WebTransportError === true, name === "WebTransportError")
messageYesUTF-8 DOMString preserved verbatim
sourceYesValidated enum discriminant ("stream" or "session")
streamErrorCodeYesPresence flag (0/1) plus full 32-bit unsigned integer (or null)
stackNo (reserved)Wire format reserves an empty stack string in version 1; JS stack trace is intentionally not serialized

Writer kill switch vs permanent decoder. Writer-side serialization is gated by RuntimeEnabledFeatures::WebTransportErrorSerializationEnabled(), while deserialization in V8ScriptValueDeserializerForModules::ReadDOMObject() remains permanently enabled so previously persisted IndexedDB records decode cleanly even if the writer switch is turned off.

Source: Blink v8_script_value_serializer_for_modules.cc; Blink v8_script_value_deserializer_for_modules.cc; ChromeStatus 5158277221580800.

Errors, edge cases, and recovery

Source: Blink deserializer validation; ChromeStatus compatibility & security notes.

Context and exposure

WebTransportError is exposed in Window and Worker (dedicated, shared, and service workers) and requires a Secure Context ([Exposed=(Window,Worker), Serializable, SecureContext]). Constructing or cloning a WebTransportError does not require an active WebTransport connection, permission, or user activation.

Source: W3C WebTransport §12; Blink web_transport_error.idl.

Lifecycle and state transitions

WebTransportError instances are immutable value objects once constructed: message, name, code, source, and streamErrorCode are read-only. They are created either by user agents when a stream or session fails over HTTP/3 / QUIC, or by application script passing an error reason to WritableStream.abort(reason) / ReadableStream.cancel(reason). Passing a WebTransportError through structuredClone(), postMessage(), or IndexedDB creates an independent copy in the receiving realm with identical message, source, and streamErrorCode (without retaining the original JS stack trace).

Source: W3C WebTransport §12; Blink web_transport_error.cc.

Examples

Live interactive example: Constructor overloads (also see Stream error code range, Worker error relay, Persisted error log, and Migration shim).Source: Chrome Platform Showcase — WebTransportError API alignment and serialization

Standard constructor, 32-bit error code, and structured cloning across a Worker

// Standard W3C (message, options) constructor with a >255 32-bit error code
const err = new WebTransportError("Stream quota exceeded", {
  source: "stream",
  streamErrorCode: 70000,
});

console.log(err instanceof DOMException); // true
console.log(err.name);                    // "WebTransportError"
console.log(err.source);                  // "stream"
console.log(err.streamErrorCode);         // 70000 (not truncated to 8 bits)

// Structured clone preserves subtype, message, source, and streamErrorCode
const cloned = structuredClone(err);
console.log(cloned instanceof WebTransportError); // true
console.log(cloned.streamErrorCode === 70000);    // true

// Relay directly from a Worker to the Window via postMessage()
self.postMessage({ kind: "wt-error", error: err });
Source: Blink web_transport_error_test.cc; W3C WebTransport §12.

Cross-browser construction and clone feature detection

function createWebTransportErrorSafe(message, options = {}) {
  const probe = new WebTransportError(message, options);
  // Pre-159 Chromium ignored (message, options) and required the legacy WebTransportErrorInit dictionary
  if (message && probe.message !== message) {
    return new WebTransportError({
      message,
      streamErrorCode: options.streamErrorCode ?? 0,
    });
  }
  return probe;
}

function canCloneWebTransportError() {
  try {
    const src = new WebTransportError("probe", { source: "session", streamErrorCode: 70000 });
    const copy = structuredClone(src);
    return (
      copy instanceof WebTransportError &&
      copy.message === "probe" &&
      copy.source === "session" &&
      copy.streamErrorCode === 70000
    );
  } catch {
    return false;
  }
}
Source: ChromeStatus 5158277221580800; Chrome Platform Showcase migration-shim concept.

Browser compatibility

Support for WebTransportError standard constructor, 32-bit streamErrorCode, and [Serializable] cloning. BCD does not yet track these alignment subfeatures separately; status combines BCD base support with ChromeStatus and engine bugs (checked 2026-11-24).
BrowserAlignment & serializationBase WebTransportError (BCD)Notes & evidence
Chrome (desktop, Android, WebView)159 (flag)
160 (target)
97Developer trial behind #enable-experimental-web-platform-features in Chrome 159; shipping enabled by default targeted for Chrome 160 per ChromeStatus 5158277221580800. Retains legacy dictionary overload
EdgeUnknown (Chromium mirror)97 (mirror)Chromium-based; follows Chromium milestone rollout
FirefoxShipped114Standard constructor, 32-bit streamErrorCode, and serialization shipped per Bug 2009530 and WPT PR #63842 (exact release number not listed in BCD)
SafariShipped (26.4)26.4Standard constructor, 32-bit error code, and serialization implemented per WebKit Bug 305224 and BCD
Source: BCD api/WebTransportError.json; ChromeStatus API record; Firefox Bug 2009530; WebKit Bug 305224.

Security and privacy

Aligning WebTransportError and making it serializable grants no new network capability, reveals no new server or user information, and preserves WebTransport’s [SecureContext] restriction. Structured cloning copies only the WebTransportError subtype, DOMString message, source enum ("stream"/"session"), and nullable 32-bit streamErrorCode (stack traces are not serialized). Blink’s versioned decoder strictly validates the format version, enum discriminants, presence flag, UTF-8 code units, and payload length before instantiating a WebTransportError. ChromeStatus rates security risk as Low and lists formal security and privacy reviews as Pending (checked 2026-11-24).

Source: ChromeStatus security_risks (5158277221580800); Blink deserializer validation.

Specifications

see also