<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>304996</bug_id>
          
          <creation_ts>2026-01-06 11:30:40 -0800</creation_ts>
          <short_desc>WebTransportError constructor mishandles single options argument and treats it as message</short_desc>
          <delta_ts>2026-01-08 13:21:24 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="ankshit">ankshit_jain</reporter>
          <assigned_to name="Alex Christensen">achristensen</assigned_to>
          <cc>achristensen</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2169673</commentid>
    <comment_count>0</comment_count>
    <who name="ankshit">ankshit_jain</who>
    <bug_when>2026-01-06 11:30:40 -0800</bug_when>
    <thetext>When WebTransportError is constructed with a single options object argument, the object is incorrectly interpreted as the message parameter and stringified to &quot;[object Object]&quot;, rather than being recognized as the options dictionary.

```
  // Fail
  const e1 = new WebTransportError({ streamErrorCode: 42 });
  console.log(e1.streamErrorCode);         // null (expected: 42)
  console.log(e1.message);                      // &quot;[object Object]&quot; (expected: &quot;&quot;)

  // Pass
  const e2 = new WebTransportError(&apos;test error&apos;, { streamErrorCode: 42 });
  console.log(e2.streamErrorCode);       // 42 (expected: 42)
  console.log(e2.message);                     // &quot;test error&quot; (expected: &quot;test error&quot;)
```

The IDL interface correctly marks both arguments as optional:
```
interface WebTransportError : DOMException {
    constructor(optional DOMString message = &quot;&quot;, optional WebTransportErrorOptions options = {});

    readonly attribute WebTransportErrorSource source;
    readonly attribute unsigned long? streamErrorCode;
};
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2169685</commentid>
    <comment_count>1</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2026-01-06 12:18:08 -0800</bug_when>
    <thetext>This seems to be an issue with the generated JSWebTransportErrorDOMConstructor::construct.  I&apos;m not sure if we have other functions with multiple optional arguments of different types, but it should try to line up the types.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2169889</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-01-06 17:44:02 -0800</bug_when>
    <thetext>&lt;rdar://problem/167662230&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2169893</commentid>
    <comment_count>3</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2026-01-06 17:46:20 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/56176</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2170401</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-01-08 13:21:22 -0800</bug_when>
    <thetext>Committed 305306@main (d6cbf74934a6): &lt;https://commits.webkit.org/305306@main&gt;

Reviewed commits have been landed. Closing PR #56176 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>