Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a capability for returning the default user agent header value #1790

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

OrKoN
Copy link
Contributor

@OrKoN OrKoN commented Feb 8, 2024

The capability cannot be used for matching as it only provides a computed value.

Issue w3c/webdriver-bidi#446
Related w3c/webdriver-bidi#652


Preview | Diff

@OrKoN OrKoN force-pushed the orkon/user-agent-capability branch 3 times, most recently from b0401c0 to b834d2b Compare February 8, 2024 13:19
@OrKoN OrKoN marked this pull request as ready for review February 8, 2024 13:39
@OrKoN OrKoN changed the title Add userAgent capability Add a capability for returning the default user agent header value Feb 8, 2024
@whimboo whimboo requested a review from jgraham February 8, 2024 20:24
@whimboo
Copy link
Contributor

whimboo commented Feb 8, 2024

This looks fine to me. @jgraham and @gsnedders mind checking as well?

@gsnedders
Copy link
Contributor

Does this not also need processing in "validate capabilities" (and maybe more in "matching capabilities"? it's not clear to me whether that's deliberately only a subset of capabilities).

As far as I can tell, with this PR passing:

{
  "capabilities": {
    "alwaysMatch": {
      "userAgent": "This/1.0 Is/2.0 Not/3.0 (A User-Agent String"
    }
  }
}

…does nothing, and it will still manage to satisfy the capabilities?

@OrKoN
Copy link
Contributor Author

OrKoN commented Feb 9, 2024

@gsnedders I intended to add userAgent as an output capability only as described by this definition("provide any computed value to return to the user") so it should not be interpreted as part of the capabilities request (and my understanding is that in this case updates to the validation algorithms are not needed).

@whimboo
Copy link
Contributor

whimboo commented Feb 12, 2024

Note that no-one will most likely match capabilities on the user agent string given its wide variance. Therefore we have the browserName and platform instead.

@OrKoN
Copy link
Contributor Author

OrKoN commented Feb 12, 2024

So I believe the following in the request

{
  "capabilities": {
    "alwaysMatch": {
      "userAgent": "This/1.0 Is/2.0 Not/3.0 (A User-Agent String"
    }
  }
}

would result in a failure to create a session according to https://w3c.github.io/webdriver/#dfn-matching-capabilities (Step 3, the Otherwise clause).

We had a discussion with @sadym-chromium and @jrandolf and we are wondering if we should instead allow clients to opt-in into getting the capability result? E.g., by sending

{
  "capabilities": {
    "alwaysMatch": {
      "userAgent": true
    }
  }
}

the client will receive the userAgent string in the response.

@OrKoN
Copy link
Contributor Author

OrKoN commented Feb 15, 2024

Updated the PR to handle userAgent when matching capabilities.

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
@OrKoN OrKoN force-pushed the orkon/user-agent-capability branch from 5dee860 to 48c3ce6 Compare February 20, 2024 08:57
@jgraham
Copy link
Member

jgraham commented Feb 21, 2024

FWIW I'm happy with this only being returned, not used as the basis for a match.

index.html Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Show resolved Hide resolved
@whimboo
Copy link
Contributor

whimboo commented Feb 27, 2024

@OrKoN I assume that you want to add a new test for classic that checks for the user agent to be part of the session capabilities? We should probably have a separate test for now until all browsers have support for it.

@OrKoN OrKoN force-pushed the orkon/user-agent-capability branch from bc3f434 to 5d43fbb Compare February 28, 2024 07:15
@OrKoN OrKoN merged commit 52c3e3a into master Mar 7, 2024
2 checks passed
@OrKoN OrKoN deleted the orkon/user-agent-capability branch March 7, 2024 11:44
github-actions bot added a commit that referenced this pull request Mar 7, 2024
…1790)

SHA: 52c3e3a
Reason: push, by OrKoN

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@whimboo
Copy link
Contributor

whimboo commented Mar 7, 2024

@OrKoN are you going to add a wpt test for it?

@OrKoN
Copy link
Contributor Author

OrKoN commented Mar 7, 2024

Yes, I am on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants