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
Why:
Relevant best practice - Add explicit validation and null/availability guards at integration boundaries by checking presence/type/range before use.
Low
Defensively copy caller collections
Copy caller-provided enumerables (e.g., via ToArray()) when assigning to option properties so later mutations of the original collection don’t affect the command options.
Why:
Relevant best practice - When storing collection-like state from callers, make defensive copies to avoid leaking internal mutable state and unexpected external mutation.
Low
General
Make base options class abstract
Mark the ContextAddInterceptOptions base class as abstract to prevent direct instantiation and clarify its role. This ensures only its more specific derived classes are used.
-public class ContextAddInterceptOptions : CommandOptions+public abstract class ContextAddInterceptOptions : CommandOptions
{
public IEnumerable<UrlPattern>? UrlPatterns { get; set; }
}
Apply / Chat
Suggestion importance[1-10]: 5
__
Why: The suggestion correctly identifies that ContextAddInterceptOptions acts as a base class and making it abstract is a good design practice to enforce this role, improving code robustness.
Low
✅ Use standard braces for class definitionSuggestion Impact:The class ContextSetCacheBehaviorOptions was changed from an empty semicolon-terminated declaration to a brace-based class body, aligning with the suggested C# style. The commit also added an internal helper method inside the class, so it was not a purely stylistic change.
Replace the semicolon with curly braces {} for the empty class definition of ContextSetCacheBehaviorOptions to improve readability and align with conventional C# style.
-public sealed class ContextSetCacheBehaviorOptions : CommandOptions;+public sealed class ContextSetCacheBehaviorOptions : CommandOptions+{+}
[Suggestion processed]
Suggestion importance[1-10]: 3
__
Why: This is a valid stylistic suggestion that improves code consistency and readability by adhering to common C# conventions for empty class definitions.
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
💥 What does this PR do?
BrowsingContext*OptionstoContext*OptionsTimeoutcommand property🔄 Types of changes
PR Type
Enhancement, Bug fix
Description
Rename
BrowsingContext*OptionstoContext*Optionsfor consistencyConvert context options from records to classes inheriting
CommandOptionsPropagate
Timeoutproperty from context options to command optionsAlign context-aware command options with parent class structure
Diagram Walkthrough
File Walkthrough
BrowsingContext.cs
Update GetTreeAsync method signaturedotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs
ContextGetTreeOptionsinstead ofBrowsingContextGetTreeOptionsBrowsingContextNetworkModule.cs
Update network module method signaturesdotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextNetworkModule.cs
AddDataCollectorAsyncmethod to useContextAddDataCollectorOptionsSetCacheBehaviorAsyncmethod to useContextSetCacheBehaviorOptionsBrowsingContextScriptModule.cs
Update script module method signaturedotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextScriptModule.cs
AddPreloadScriptAsyncmethod to useContextAddPreloadScriptOptionsGetTreeCommand.cs
Refactor GetTreeOptions and ContextGetTreeOptionsdotnet/src/webdriver/BiDi/BrowsingContext/GetTreeCommand.cs
GetTreeOptionsto use primary constructorBrowsingContextGetTreeOptionstoContextGetTreeOptionsandchange from record to class inheriting
CommandOptionsTimeoutproperty propagation from context optionsAddDataCollectorCommand.cs
Refactor AddDataCollectorOptions and ContextAddDataCollectorOptionsdotnet/src/webdriver/BiDi/Network/AddDataCollectorCommand.cs
sealedmodifier toAddDataCollectorOptionsBrowsingContextAddDataCollectorOptionstoContextAddDataCollectorOptionsand change from class to sealed classinheriting
CommandOptionsTimeoutproperty propagation from context optionsAddInterceptCommand.cs
Refactor AddInterceptOptions and ContextAddInterceptOptionsdotnet/src/webdriver/BiDi/Network/AddInterceptCommand.cs
sealedmodifier toAddInterceptOptionsBrowsingContextAddInterceptOptionstoContextAddInterceptOptionsand change from record to class inheritingCommandOptionsTimeoutproperty propagation from context optionsSetCacheBehaviorCommand.cs
Refactor SetCacheBehaviorOptions and ContextSetCacheBehaviorOptionsdotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs
BrowsingContextSetCacheBehaviorOptionstoContextSetCacheBehaviorOptionsand change from record to sealed classinheriting
CommandOptionsTimeoutproperty propagation from context optionsAddPreloadScriptCommand.cs
Refactor AddPreloadScriptOptions and ContextAddPreloadScriptOptionsdotnet/src/webdriver/BiDi/Script/AddPreloadScriptCommand.cs
AddPreloadScriptOptionsto use primary constructorBrowsingContextAddPreloadScriptOptionstoContextAddPreloadScriptOptionsand change from record to sealed classinheriting
CommandOptionsTimeoutproperty propagation from context options