diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/BrowsingContextStorageModule.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/BrowsingContextStorageModule.cs index 3c2dd4d641a5a..2be053ed7226d 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/BrowsingContextStorageModule.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/BrowsingContextStorageModule.cs @@ -28,7 +28,7 @@ public Task GetCookiesAsync(GetCookiesOptions? options = null) { options ??= new(); - options.Partition = new PartitionDescriptor.Context(context); + options.Partition = new ContextPartitionDescriptor(context); return storageModule.GetCookiesAsync(options); } @@ -37,7 +37,7 @@ public async Task DeleteCookiesAsync(DeleteCookiesOptions? options { options ??= new(); - options.Partition = new PartitionDescriptor.Context(context); + options.Partition = new ContextPartitionDescriptor(context); var res = await storageModule.DeleteCookiesAsync(options).ConfigureAwait(false); @@ -48,7 +48,7 @@ public async Task SetCookieAsync(PartialCookie cookie, SetCookieOp { options ??= new(); - options.Partition = new PartitionDescriptor.Context(context); + options.Partition = new ContextPartitionDescriptor(context); var res = await storageModule.SetCookieAsync(cookie, options).ConfigureAwait(false); diff --git a/dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs index 1cf13bd5489ed..1f0f06806bcc3 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs @@ -80,16 +80,15 @@ public class CookieFilter } [JsonPolymorphic(TypeDiscriminatorPropertyName = "type")] -[JsonDerivedType(typeof(Context), "context")] -[JsonDerivedType(typeof(StorageKey), "storageKey")] -public abstract record PartitionDescriptor -{ - public record Context([property: JsonPropertyName("context")] BrowsingContext.BrowsingContext Descriptor) : PartitionDescriptor; +[JsonDerivedType(typeof(ContextPartitionDescriptor), "context")] +[JsonDerivedType(typeof(StorageKeyPartitionDescriptor), "storageKey")] +public abstract record PartitionDescriptor; - public record StorageKey : PartitionDescriptor - { - public string? UserContext { get; set; } +public record ContextPartitionDescriptor(BrowsingContext.BrowsingContext Context) : PartitionDescriptor; - public string? SourceOrigin { get; set; } - } +public record StorageKeyPartitionDescriptor : PartitionDescriptor +{ + public string? UserContext { get; set; } + + public string? SourceOrigin { get; set; } }