Re: [whatwg/fetch] [WebDriver BiDi] emulate `user-agent` string (PR #1851)

@annevk commented on this pull request.

I had these comments, but you just refactored it further. I'm not sure I like removing the default User-Agent value concept entirely. Is that really what we want?

I now also wonder at what point implementations ask WebDriver for this value as it seems unlikely to happen in het network layer, where the User-Agent value is currently appended.

> +<div algorithm>
+<p>To get the <a>environment settings object</a> <var>environment</var>'s
+<dfn export id=environment-default-user-agent-value>environment default `<code>User-Agent</code>` value</dfn>:
+
+<ol>
+ <li><p>Let <var>userAgent</var> be the <a>WebDriver BiDi emulated User-Agent</a> for
+ <var>environment</var>.
+
+ <li><p>If <var>userAgent</var> is not null, then return <a>isomorphic encoded</a>
+ <var>userAgent</var>.
+
+ <li><p>Return <a>default `<code>User-Agent</code>` value</a>.
+</ol>
+</div>

```suggestion
<div algorithm>
<p>To get the <a>environment settings object</a> <var>environment</var>'s
<dfn export>environment default `<code>User-Agent</code>` value</dfn>:

<ol>
 <li><p>Let <var>userAgent</var> be the <a>WebDriver BiDi emulated User-Agent</a> for
 <var>environment</var>.

 <li><p>If <var>userAgent</var> is non-null, then return <var>userAgent</var>,
 <a>isomorphic encoded</a>.

 <li><p>Return the <a>default `<code>User-Agent</code>` value</a>.
</ol>
</div>
```

> +    <p>If <var>httpRequest</var>'s <a for=request>header list</a> <a
+    for="header list">does not contain</a> `<code>User-Agent</code>`, then user agents should run
+    the following steps:
+
+    <ol>
+     <li><p>Let <var>userAgent</var> be the <var>httpRequest</var>'s <a for=request>client</a>'s
+     <a>environment default `<code>User-Agent</code>` value</a>.
+
+     <li><p><a for="header list">Append</a> (`<code>User-Agent</code>`, <var>userAgent</var>) to
+     <var>httpRequest</var>'s <a for=request>header list</a>.

```suggestion
    <p>If <var>httpRequest</var>'s <a for=request>header list</a> <a
    for="header list">does not contain</a> `<code>User-Agent</code>`, then user agents should:

    <ol>
     <li><p>Let <var>userAgent</var> be <var>httpRequest</var>'s <a for=request>client</a>'s
     <a>environment default `<code>User-Agent</code>` value</a>.

     <li><p><a for="header list">Append</a> (`<code>User-Agent</code>`, <var>userAgent</var>) to
     <var>httpRequest</var>'s <a for=request>header list</a>.
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1851#pullrequestreview-3229996558
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1851/review/3229996558@github.com>

Received on Tuesday, 16 September 2025 13:29:33 UTC