v159 · webtransport · basic

Constructor overloads

Chrome 159’s WebTransportError has two constructors. The standard one, (optional DOMString message = "", optional WebTransportErrorOptions options = {}), is what the spec, Firefox and Safari use. The legacy one, (WebTransportErrorInit init, optional any legacyIgnored), is the dictionary shape Chromium shipped first and keeps for compatibility. Build one of each and see what this browser actually returns.

Enabled by default from Chrome 159. In a developer-trial build turn on chrome://flags/#enable-experimental-web-platform-features. The new constructor has no separate runtime flag. On a build without it, the standard call throws TypeError: … not of type 'WebTransportErrorInit' — the page shows that error instead of hiding it.

Build an error

Constructor shape

The legacy dictionary has no source member, so the legacy call never sends it.

Leave empty for null. Values pass through WebIDL [Clamp] conversion.

// press Construct
result
not run yet
name
—
message
—
code
—
source
—
streamErrorCode
—
instanceof DOMException
—

Not run yet.

Which overload does WebIDL pick?

With two constructors, WebIDL overload resolution looks at the first argument: an object (or null) selects the dictionary overload, undefined selects the overload whose first argument is optional, and anything else is converted to a DOMString. Each row runs the call for real in this browser and compares the outcome with Chrome 159’s IDL.

Call shape → outcome in this browser vs the Chrome 159 contract
callChrome 159 contractthis browsermatches?
Not run yet.

Not run yet.

see also