From aa4d1e19afefc0435297a08ccdda4717a704a168 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Mon, 1 Dec 2025 20:36:52 +0300 Subject: [PATCH 1/2] [dotnet] [bidi] Avoid BiDi type in EventArgs ctor for unnecessary metadata generation --- .../BrowsingContext/BrowsingContextInfo.cs | 4 +-- .../BrowsingContext/DownloadEndEventArgs.cs | 12 ++++----- .../DownloadWillBeginEventArgs.cs | 4 +-- .../HistoryUpdatedEventArgs.cs | 4 +-- .../BiDi/BrowsingContext/NavigationInfo.cs | 4 +-- .../UserPromptClosedEventArgs.cs | 4 +-- .../UserPromptOpenedEventArgs.cs | 4 +-- dotnet/src/webdriver/BiDi/EventArgs.cs | 8 +++--- dotnet/src/webdriver/BiDi/Log/LogEntry.cs | 16 +++++------ .../BiDi/Network/AuthRequiredEventArgs.cs | 4 +-- .../BiDi/Network/BaseParametersEventArgs.cs | 6 ++--- .../Network/BeforeRequestSentEventArgs.cs | 4 +-- .../BiDi/Network/FetchErrorEventArgs.cs | 4 +-- .../BiDi/Network/NetworkModule.HighLevel.cs | 27 ++++++++++++++----- .../Network/ResponseCompletedEventArgs.cs | 4 +-- .../BiDi/Network/ResponseStartedEventArgs.cs | 4 +-- .../webdriver/BiDi/Script/MessageEventArgs.cs | 2 +- .../BiDi/Script/RealmDestroyedEventArgs.cs | 2 +- dotnet/src/webdriver/BiDi/Script/RealmInfo.cs | 18 ++++++------- 19 files changed, 75 insertions(+), 60 deletions(-) diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInfo.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInfo.cs index 5dbfe555921b7..d3f1d0da65c43 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInfo.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInfo.cs @@ -21,5 +21,5 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; -public sealed record BrowsingContextInfo(BiDi BiDi, IReadOnlyList? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent) - : BrowsingContextEventArgs(BiDi, Context); +public sealed record BrowsingContextInfo(IReadOnlyList? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent) + : BrowsingContextEventArgs(Context); diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/DownloadEndEventArgs.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/DownloadEndEventArgs.cs index 38d51c22e8b54..c6d0be92e07b3 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/DownloadEndEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/DownloadEndEventArgs.cs @@ -28,11 +28,11 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; //[JsonDerivedType(typeof(DownloadCanceledEventArgs), "canceled")] //[JsonDerivedType(typeof(DownloadCompleteEventArgs), "complete")] [JsonConverter(typeof(DownloadEndEventArgsConverter))] -public abstract record DownloadEndEventArgs(BiDi BiDi, BrowsingContext Context) - : BrowsingContextEventArgs(BiDi, Context); +public abstract record DownloadEndEventArgs(BrowsingContext Context) + : BrowsingContextEventArgs(Context); -public sealed record DownloadCanceledEventArgs(BiDi BiDi, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url) - : DownloadEndEventArgs(BiDi, Context), IBaseNavigationInfo; +public sealed record DownloadCanceledEventArgs(BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url) + : DownloadEndEventArgs(Context), IBaseNavigationInfo; -public sealed record DownloadCompleteEventArgs(BiDi BiDi, string? Filepath, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url) - : DownloadEndEventArgs(BiDi, Context), IBaseNavigationInfo; +public sealed record DownloadCompleteEventArgs(string? Filepath, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url) + : DownloadEndEventArgs(Context), IBaseNavigationInfo; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/DownloadWillBeginEventArgs.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/DownloadWillBeginEventArgs.cs index a1db10de67a1b..a2a4c66d3bd45 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/DownloadWillBeginEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/DownloadWillBeginEventArgs.cs @@ -21,5 +21,5 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; -public sealed record DownloadWillBeginEventArgs(BiDi BiDi, string SuggestedFilename, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url) - : BrowsingContextEventArgs(BiDi, Context), IBaseNavigationInfo; +public sealed record DownloadWillBeginEventArgs(string SuggestedFilename, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url) + : BrowsingContextEventArgs(Context), IBaseNavigationInfo; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/HistoryUpdatedEventArgs.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/HistoryUpdatedEventArgs.cs index 492b66a0a4e4f..88bd828c38343 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/HistoryUpdatedEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/HistoryUpdatedEventArgs.cs @@ -21,5 +21,5 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; -public sealed record HistoryUpdatedEventArgs(BiDi BiDi, BrowsingContext Context, DateTimeOffset Timestamp, string Url) - : BrowsingContextEventArgs(BiDi, Context); +public sealed record HistoryUpdatedEventArgs(BrowsingContext Context, DateTimeOffset Timestamp, string Url) + : BrowsingContextEventArgs(Context); diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs index 25e994a11eedc..32a742b50f5ba 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs @@ -21,5 +21,5 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; -public sealed record NavigationInfo(BiDi BiDi, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url) - : BrowsingContextEventArgs(BiDi, Context), IBaseNavigationInfo; +public sealed record NavigationInfo(BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url) + : BrowsingContextEventArgs(Context), IBaseNavigationInfo; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptClosedEventArgs.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptClosedEventArgs.cs index 3e2572203c627..6fab79a96fb0c 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptClosedEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptClosedEventArgs.cs @@ -19,5 +19,5 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; -public sealed record UserPromptClosedEventArgs(BiDi BiDi, BrowsingContext Context, bool Accepted, string? UserText) - : BrowsingContextEventArgs(BiDi, Context); +public sealed record UserPromptClosedEventArgs(BrowsingContext Context, bool Accepted, string? UserText) + : BrowsingContextEventArgs(Context); diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptOpenedEventArgs.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptOpenedEventArgs.cs index 2360cc26c9a8b..fdc61fd06d2fa 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptOpenedEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptOpenedEventArgs.cs @@ -22,8 +22,8 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; -public sealed record UserPromptOpenedEventArgs(BiDi BiDi, BrowsingContext Context, Session.UserPromptHandlerType Handler, UserPromptType Type, string Message, string? DefaultValue) - : BrowsingContextEventArgs(BiDi, Context); +public sealed record UserPromptOpenedEventArgs(BrowsingContext Context, Session.UserPromptHandlerType Handler, UserPromptType Type, string Message, string? DefaultValue) + : BrowsingContextEventArgs(Context); [JsonConverter(typeof(CamelCaseEnumConverter))] public enum UserPromptType diff --git a/dotnet/src/webdriver/BiDi/EventArgs.cs b/dotnet/src/webdriver/BiDi/EventArgs.cs index 309adddf17a69..2e1b59ec59e01 100644 --- a/dotnet/src/webdriver/BiDi/EventArgs.cs +++ b/dotnet/src/webdriver/BiDi/EventArgs.cs @@ -21,11 +21,11 @@ namespace OpenQA.Selenium.BiDi; -public abstract record EventArgs(BiDi BiDi) +public abstract record EventArgs { [JsonIgnore] - public BiDi BiDi { get; internal set; } = BiDi; + public BiDi BiDi { get; internal set; } } -public abstract record BrowsingContextEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext Context) - : EventArgs(BiDi); +public abstract record BrowsingContextEventArgs(BrowsingContext.BrowsingContext Context) + : EventArgs; diff --git a/dotnet/src/webdriver/BiDi/Log/LogEntry.cs b/dotnet/src/webdriver/BiDi/Log/LogEntry.cs index ed68fb3830193..37e3fca84f355 100644 --- a/dotnet/src/webdriver/BiDi/Log/LogEntry.cs +++ b/dotnet/src/webdriver/BiDi/Log/LogEntry.cs @@ -31,20 +31,20 @@ namespace OpenQA.Selenium.BiDi.Log; //[JsonDerivedType(typeof(ConsoleLogEntry), "console")] //[JsonDerivedType(typeof(JavascriptLogEntry), "javascript")] [JsonConverter(typeof(LogEntryConverter))] -public abstract record LogEntry(BiDi BiDi, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) - : EventArgs(BiDi) +public abstract record LogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) + : EventArgs { public Script.StackTrace? StackTrace { get; set; } } -public sealed record GenericLogEntry(BiDi BiDi, string Type, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) - : LogEntry(BiDi, Level, Source, Text, Timestamp); +public sealed record GenericLogEntry(string Type, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) + : LogEntry(Level, Source, Text, Timestamp); -public sealed record ConsoleLogEntry(BiDi BiDi, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp, string Method, IReadOnlyList Args) - : LogEntry(BiDi, Level, Source, Text, Timestamp); +public sealed record ConsoleLogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp, string Method, IReadOnlyList Args) + : LogEntry(Level, Source, Text, Timestamp); -public sealed record JavascriptLogEntry(BiDi BiDi, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) - : LogEntry(BiDi, Level, Source, Text, Timestamp); +public sealed record JavascriptLogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) + : LogEntry(Level, Source, Text, Timestamp); [JsonConverter(typeof(CamelCaseEnumConverter))] public enum Level diff --git a/dotnet/src/webdriver/BiDi/Network/AuthRequiredEventArgs.cs b/dotnet/src/webdriver/BiDi/Network/AuthRequiredEventArgs.cs index ba61acf4eb928..94370f73e50a7 100644 --- a/dotnet/src/webdriver/BiDi/Network/AuthRequiredEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/Network/AuthRequiredEventArgs.cs @@ -22,5 +22,5 @@ namespace OpenQA.Selenium.BiDi.Network; -public record AuthRequiredEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList? Intercepts) : - BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); +public record AuthRequiredEventArgs(BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList? Intercepts) : + BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); diff --git a/dotnet/src/webdriver/BiDi/Network/BaseParametersEventArgs.cs b/dotnet/src/webdriver/BiDi/Network/BaseParametersEventArgs.cs index d438d714c6add..3408ec8646690 100644 --- a/dotnet/src/webdriver/BiDi/Network/BaseParametersEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/Network/BaseParametersEventArgs.cs @@ -17,10 +17,10 @@ // under the License. // -using System.Collections.Generic; using System; +using System.Collections.Generic; namespace OpenQA.Selenium.BiDi.Network; -public abstract record BaseParametersEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, IReadOnlyList? Intercepts) - : BrowsingContextEventArgs(BiDi, Context); +public abstract record BaseParametersEventArgs(BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, IReadOnlyList? Intercepts) + : BrowsingContextEventArgs(Context); diff --git a/dotnet/src/webdriver/BiDi/Network/BeforeRequestSentEventArgs.cs b/dotnet/src/webdriver/BiDi/Network/BeforeRequestSentEventArgs.cs index f73dccf71d7f8..a88befe4104aa 100644 --- a/dotnet/src/webdriver/BiDi/Network/BeforeRequestSentEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/Network/BeforeRequestSentEventArgs.cs @@ -23,5 +23,5 @@ namespace OpenQA.Selenium.BiDi.Network; -public record BeforeRequestSentEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, Initiator Initiator, IReadOnlyList? Intercepts) - : BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); +public record BeforeRequestSentEventArgs(BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, Initiator Initiator, IReadOnlyList? Intercepts) + : BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); diff --git a/dotnet/src/webdriver/BiDi/Network/FetchErrorEventArgs.cs b/dotnet/src/webdriver/BiDi/Network/FetchErrorEventArgs.cs index ab19d29f69215..f3ed8fb40720e 100644 --- a/dotnet/src/webdriver/BiDi/Network/FetchErrorEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/Network/FetchErrorEventArgs.cs @@ -23,5 +23,5 @@ namespace OpenQA.Selenium.BiDi.Network; -public sealed record FetchErrorEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, string ErrorText, IReadOnlyList? Intercepts) - : BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); +public sealed record FetchErrorEventArgs(BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, string ErrorText, IReadOnlyList? Intercepts) + : BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); diff --git a/dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs b/dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs index 0a3b356f0b577..f1634fb61213f 100644 --- a/dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs +++ b/dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs @@ -59,9 +59,14 @@ public sealed class InterceptResponseOptions : AddInterceptOptions; public sealed class InterceptAuthOptions : AddInterceptOptions; -public sealed record InterceptedRequest(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, Initiator Initiator, IReadOnlyList? Intercepts) - : BeforeRequestSentEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Initiator, Intercepts) +public sealed record InterceptedRequest : BeforeRequestSentEventArgs { + internal InterceptedRequest(BiDi biDi, BrowsingContext.BrowsingContext? context, bool isBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, Initiator initiator, IReadOnlyList? intercepts) + : base(context, isBlocked, navigation, redirectCount, request, timestamp, initiator, intercepts) + { + BiDi = biDi; + } + public Task ContinueAsync(ContinueRequestOptions? options = null) { return BiDi.Network.ContinueRequestAsync(Request.Request, options); @@ -78,18 +83,28 @@ public Task ProvideResponseAsync(ProvideResponseOptions? options = null) } } -public sealed record InterceptedResponse(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList? Intercepts) - : ResponseStartedEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Response, Intercepts) +public sealed record InterceptedResponse : ResponseStartedEventArgs { + internal InterceptedResponse(BiDi biDi, BrowsingContext.BrowsingContext? context, bool isBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, ResponseData response, IReadOnlyList? intercepts) + : base(context, isBlocked, navigation, redirectCount, request, timestamp, response, intercepts) + { + BiDi = biDi; + } + public Task ContinueAsync(ContinueResponseOptions? options = null) { return BiDi.Network.ContinueResponseAsync(Request.Request, options); } } -public sealed record InterceptedAuth(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList? Intercepts) - : AuthRequiredEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Response, Intercepts) +public sealed record InterceptedAuth : AuthRequiredEventArgs { + internal InterceptedAuth(BiDi biDi, BrowsingContext.BrowsingContext? context, bool IsBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, ResponseData response, IReadOnlyList? intercepts) + : base(context, IsBlocked, navigation, redirectCount, request, timestamp, response, intercepts) + { + BiDi = biDi; + } + public Task ContinueAsync(AuthCredentials credentials, ContinueWithAuthCredentialsOptions? options = null) { return BiDi.Network.ContinueWithAuthAsync(Request.Request, credentials, options); diff --git a/dotnet/src/webdriver/BiDi/Network/ResponseCompletedEventArgs.cs b/dotnet/src/webdriver/BiDi/Network/ResponseCompletedEventArgs.cs index f91e3293cc9c1..8d81a65a8ace6 100644 --- a/dotnet/src/webdriver/BiDi/Network/ResponseCompletedEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/Network/ResponseCompletedEventArgs.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Network; -public sealed record ResponseCompletedEventArgs(BiDi BiDi, +public sealed record ResponseCompletedEventArgs( BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, @@ -32,4 +32,4 @@ public sealed record ResponseCompletedEventArgs(BiDi BiDi, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList? Intercepts) - : BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); + : BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); diff --git a/dotnet/src/webdriver/BiDi/Network/ResponseStartedEventArgs.cs b/dotnet/src/webdriver/BiDi/Network/ResponseStartedEventArgs.cs index 7b80a936f0acd..eaf62c97e3ff9 100644 --- a/dotnet/src/webdriver/BiDi/Network/ResponseStartedEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/Network/ResponseStartedEventArgs.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Network; -public record ResponseStartedEventArgs(BiDi BiDi, +public record ResponseStartedEventArgs( BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, @@ -32,4 +32,4 @@ public record ResponseStartedEventArgs(BiDi BiDi, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList? Intercepts) - : BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); + : BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts); diff --git a/dotnet/src/webdriver/BiDi/Script/MessageEventArgs.cs b/dotnet/src/webdriver/BiDi/Script/MessageEventArgs.cs index 3bbf2ed939a23..fd49c6c677f1a 100644 --- a/dotnet/src/webdriver/BiDi/Script/MessageEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/Script/MessageEventArgs.cs @@ -19,4 +19,4 @@ namespace OpenQA.Selenium.BiDi.Script; -public sealed record MessageEventArgs(BiDi BiDi, Channel Channel, RemoteValue Data, Source Source) : EventArgs(BiDi); +public sealed record MessageEventArgs(Channel Channel, RemoteValue Data, Source Source) : EventArgs; diff --git a/dotnet/src/webdriver/BiDi/Script/RealmDestroyedEventArgs.cs b/dotnet/src/webdriver/BiDi/Script/RealmDestroyedEventArgs.cs index 74af338ffad42..5d840a7be6d97 100644 --- a/dotnet/src/webdriver/BiDi/Script/RealmDestroyedEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/Script/RealmDestroyedEventArgs.cs @@ -19,4 +19,4 @@ namespace OpenQA.Selenium.BiDi.Script; -public sealed record RealmDestroyedEventArgs(BiDi BiDi, Realm Realm) : EventArgs(BiDi); +public sealed record RealmDestroyedEventArgs(Realm Realm) : EventArgs; diff --git a/dotnet/src/webdriver/BiDi/Script/RealmInfo.cs b/dotnet/src/webdriver/BiDi/Script/RealmInfo.cs index 956b99db23f01..6ac6332e87a0e 100644 --- a/dotnet/src/webdriver/BiDi/Script/RealmInfo.cs +++ b/dotnet/src/webdriver/BiDi/Script/RealmInfo.cs @@ -34,23 +34,23 @@ namespace OpenQA.Selenium.BiDi.Script; //[JsonDerivedType(typeof(AudioWorkletRealmInfo), "audio-worklet")] //[JsonDerivedType(typeof(WorkletRealmInfo), "worklet")] [JsonConverter(typeof(RealmInfoConverter))] -public abstract record RealmInfo(BiDi BiDi, Realm Realm, string Origin) : EventArgs(BiDi); +public abstract record RealmInfo(Realm Realm, string Origin) : EventArgs; -public sealed record WindowRealmInfo(BiDi BiDi, Realm Realm, string Origin, BrowsingContext.BrowsingContext Context) : RealmInfo(BiDi, Realm, Origin) +public sealed record WindowRealmInfo(Realm Realm, string Origin, BrowsingContext.BrowsingContext Context) : RealmInfo(Realm, Origin) { public string? Sandbox { get; set; } } -public sealed record DedicatedWorkerRealmInfo(BiDi BiDi, Realm Realm, string Origin, IReadOnlyList Owners) : RealmInfo(BiDi, Realm, Origin); +public sealed record DedicatedWorkerRealmInfo(Realm Realm, string Origin, IReadOnlyList Owners) : RealmInfo(Realm, Origin); -public sealed record SharedWorkerRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin); +public sealed record SharedWorkerRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin); -public sealed record ServiceWorkerRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin); +public sealed record ServiceWorkerRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin); -public sealed record WorkerRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin); +public sealed record WorkerRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin); -public sealed record PaintWorkletRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin); +public sealed record PaintWorkletRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin); -public sealed record AudioWorkletRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin); +public sealed record AudioWorkletRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin); -public sealed record WorkletRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin); +public sealed record WorkletRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin); From afb537078975d6fd98a8d85e527d7e2055564e17 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Mon, 1 Dec 2025 20:45:56 +0300 Subject: [PATCH 2/2] Rename to "bidi" --- .../BiDi/Network/NetworkModule.HighLevel.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs b/dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs index f1634fb61213f..58b9dfc4cd091 100644 --- a/dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs +++ b/dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs @@ -61,10 +61,10 @@ public sealed class InterceptAuthOptions : AddInterceptOptions; public sealed record InterceptedRequest : BeforeRequestSentEventArgs { - internal InterceptedRequest(BiDi biDi, BrowsingContext.BrowsingContext? context, bool isBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, Initiator initiator, IReadOnlyList? intercepts) + internal InterceptedRequest(BiDi bidi, BrowsingContext.BrowsingContext? context, bool isBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, Initiator initiator, IReadOnlyList? intercepts) : base(context, isBlocked, navigation, redirectCount, request, timestamp, initiator, intercepts) { - BiDi = biDi; + BiDi = bidi; } public Task ContinueAsync(ContinueRequestOptions? options = null) @@ -85,10 +85,10 @@ public Task ProvideResponseAsync(ProvideResponseOptions? options = null) public sealed record InterceptedResponse : ResponseStartedEventArgs { - internal InterceptedResponse(BiDi biDi, BrowsingContext.BrowsingContext? context, bool isBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, ResponseData response, IReadOnlyList? intercepts) + internal InterceptedResponse(BiDi bidi, BrowsingContext.BrowsingContext? context, bool isBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, ResponseData response, IReadOnlyList? intercepts) : base(context, isBlocked, navigation, redirectCount, request, timestamp, response, intercepts) { - BiDi = biDi; + BiDi = bidi; } public Task ContinueAsync(ContinueResponseOptions? options = null) @@ -99,10 +99,10 @@ public Task ContinueAsync(ContinueResponseOptions? options = null) public sealed record InterceptedAuth : AuthRequiredEventArgs { - internal InterceptedAuth(BiDi biDi, BrowsingContext.BrowsingContext? context, bool IsBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, ResponseData response, IReadOnlyList? intercepts) + internal InterceptedAuth(BiDi bidi, BrowsingContext.BrowsingContext? context, bool IsBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, ResponseData response, IReadOnlyList? intercepts) : base(context, IsBlocked, navigation, redirectCount, request, timestamp, response, intercepts) { - BiDi = biDi; + BiDi = bidi; } public Task ContinueAsync(AuthCredentials credentials, ContinueWithAuthCredentialsOptions? options = null)