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
The CreateDevToolsDomain method can return null but is used without null check in line 128. While the code will likely work due to the logic flow, explicit null checking would improve robustness.
The SupportedProtocolVersions array defines versions in a seemingly random order (130,132,131,85). Consider ordering them consistently to improve maintainability.
Why: Adding null validation for the session parameter is crucial for preventing NullReferenceException and providing clear error messages. This is particularly important as the session parameter is used throughout the domain initialization process.
8
Validate protocol version parameter
Add validation for negative protocol version to prevent potential issues with version matching logic.
public static DevToolsDomains InitializeDomains(int protocolVersion, DevToolsSession session, int versionRange)
{
+ if (protocolVersion < 0)+ {+ throw new ArgumentOutOfRangeException(nameof(protocolVersion), "Protocol version must not be negative");+ }
if (versionRange < 0)
{
throw new ArgumentOutOfRangeException(nameof(versionRange), "Version range must not be negative");
}
Apply this suggestion
Suggestion importance[1-10]: 7
Why: Adding validation for negative protocol versions is important for preventing invalid inputs early, especially since the version matching logic assumes positive version numbers. This complements the existing versionRange validation.
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.
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
This removes reflection paths from
DevToolsDomainsand annotates it for nullability.Motivation and Context
Contributes to #14640 and #14480
Types of changes
Checklist