Skip to content

Add bitness and wow64 properties to UserAgentMetadata#3074

Merged
kblok merged 8 commits intomasterfrom
copilot/add-bitness-property-useragentmetadata
Jan 6, 2026
Merged

Add bitness and wow64 properties to UserAgentMetadata#3074
kblok merged 8 commits intomasterfrom
copilot/add-bitness-property-useragentmetadata

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

  • Review UserAgentMetadata class and understand current implementation
  • Add Bitness property (optional string) to UserAgentMetadata class
  • Add Wow64 property (optional boolean) to UserAgentMetadata class
  • Verify that the properties are correctly serialized to CDP
  • Add test for new properties (ShouldWorkWithBitnessAndWow64)
  • Build and verify changes compile successfully
  • Code review completed (noted consistency with existing code style)
  • Security check completed (no vulnerabilities introduced)
  • Updated test attribute to use puppeteer-sharp spec

Summary

Successfully added the missing bitness and wow64 optional properties to the UserAgentMetadata class as requested in the issue.

Changes Made

  1. Added Bitness property (string) - Represents the "bitness" of the user agent (e.g., "32" or "64")
  2. Added Wow64 property (bool?) - True if on Windows and WOW64 (Windows 32-bit on Windows 64-bit)
  3. Added test - Created ShouldWorkWithBitnessAndWow64 test using puppeteer-sharp spec to verify the new properties work correctly
  4. Updated .gitignore - Added testKey.pem to ignore list for test server certificates

Implementation Details

  • Properties follow existing code patterns in UserAgentMetadata class
  • JSON serialization automatically converts to camelCase (Bitness → bitness, Wow64 → wow64)
  • Properties with null values are excluded from serialization
  • Changes are backward compatible - existing code continues to work

Chrome DevTools Protocol Compliance

These properties match the Chrome DevTools Protocol specification:

Testing

  • New test verifies both properties can be set and retrieved via navigator.userAgentData.getHighEntropyValues()
  • Test uses puppeteer-sharp spec designation for PuppeteerSharp-specific tests
  • Builds successfully with no errors or warnings
  • Backward compatible with existing tests

Resolves the issue requesting bitness and wow64 properties for UserAgentMetadata.

Original prompt

This section details on the original issue you should resolve

<issue_title>UserAgentMetadata is missing the optional 'bitness' property</issue_title>
<issue_description>Can you please add the 'bitness' property to the UserAgentMetadata class so it can be passed to CDP?
https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#type-UserAgentMetadata

Maybe also add 'wow64' as well for completeness.

Thanks!</issue_description>

Comments on the Issue (you are @copilot in this section)

@kblok Yeah. Makes sense.

Custom agent used: Bidi migration
Implement bidi code


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: kblok <2198466+kblok@users.noreply.github.com>
@kblok kblok changed the title [WIP] Add bitness property to UserAgentMetadata class Add bitness property to UserAgentMetadata class Jan 5, 2026
Copilot AI and others added 2 commits January 5, 2026 13:07
Co-authored-by: kblok <2198466+kblok@users.noreply.github.com>
Copilot AI changed the title Add bitness property to UserAgentMetadata class Add bitness and wow64 properties to UserAgentMetadata Jan 5, 2026
Copilot AI requested a review from kblok January 5, 2026 13:09
Assert.That(await requestTask, Is.EqualTo("MockBrowser"));
}

[Test, PuppeteerTest("page.spec", "Page Page.setUserAgent", "should work with bitness and wow64")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Let's use puppeteer-sharp instead of page.spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Changed to puppeteer-sharp in commit 683eb37.

Co-authored-by: kblok <2198466+kblok@users.noreply.github.com>
Copilot AI requested a review from kblok January 5, 2026 13:43
@kblok kblok marked this pull request as ready for review January 5, 2026 13:44
Copilot AI review requested due to automatic review settings January 5, 2026 13:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

UserAgentMetadata is missing the optional 'bitness' property

3 participants