You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To reduce code duplication, create a reusable base class for the multiple new command Options classes that share identical properties for targeting browsing contexts and user contexts.
// In SetTimezoneOverrideCommand.cspublicsealedclassSetTimezoneOverrideOptions:CommandOptions{publicIEnumerable<BrowsingContext.BrowsingContext>?Contexts{get;set;}publicIEnumerable<Browser.UserContext>?UserContexts{get;set;}}// In SetLocaleOverrideCommand.cspublicsealedclassSetLocaleOverrideOptions:CommandOptions{publicIEnumerable<BrowsingContext.BrowsingContext>?Contexts{get;set;}publicIEnumerable<Browser.UserContext>?UserContexts{get;set;}}// ... and 4 other identical classes
After:
// In a new shared file or a relevant existing onepublicclassContextOptions:CommandOptions{publicIEnumerable<BrowsingContext.BrowsingContext>?Contexts{get;set;}publicIEnumerable<Browser.UserContext>?UserContexts{get;set;}}// In SetTimezoneOverrideCommand.cspublicsealedclassSetTimezoneOverrideOptions:ContextOptions{}// In SetLocaleOverrideCommand.cspublicsealedclassSetLocaleOverrideOptions:ContextOptions{}// ... and so on for other option classes
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies significant code duplication across multiple new Options classes and proposes a valid solution that improves maintainability by using a shared base class.
Medium
Possible issue
Ensure correct enum JSON serialization
To ensure ForcedColorsModeTheme enum values serialize to lowercase strings as per the WebDriver BiDi specification, add the [JsonStringEnumConverter] attribute to the enum definition.
+[JsonStringEnumConverter]
public enum ForcedColorsModeTheme
{
Light,
Dark
}
Apply / Chat
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies that the ForcedColorsModeTheme enum will be serialized incorrectly as an integer, but the proposed fix using [JsonStringEnumConverter] is incomplete as it would serialize to "Light" and "Dark" instead of the required "light" and "dark".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
https://w3c.github.io/webdriver-bidi/#module-emulation
💥 What does this PR do?
Implements entire emulation module.
🔄 Types of changes
PR Type
Enhancement
Description
Implements complete WebDriver BiDi emulation module
Adds 7 emulation commands for browser behavior control
Includes timezone, user agent, locale, and geolocation overrides
Provides screen orientation and scripting control features
Diagram Walkthrough
File Walkthrough
10 files
Add emulation module property and initializationCustom JSON converter for screen orientation typesMain emulation module with all override methodsCommand for forced colors mode theme overrideCommand for geolocation coordinates and position error overrideCommand for locale override functionalityCommand for screen orientation override with enumsCommand for enabling or disabling scriptingCommand for timezone override functionalityCommand for user agent string override2 files
Register screen orientation type converterAdd JSON serialization for emulation commands1 files
Unit tests for all emulation module commands