Skip to content

Commit 8c14b7a

Browse files
nvborisenkosandeepsuryaprasad
authored andcommitted
[dotnet] [bidi] Make PartitionDescriptor as not nested (SeleniumHQ#15435)
1 parent 051786a commit 8c14b7a

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

dotnet/src/webdriver/BiDi/Modules/BrowsingContext/BrowsingContextStorageModule.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public Task<GetCookiesResult> GetCookiesAsync(GetCookiesOptions? options = null)
2828
{
2929
options ??= new();
3030

31-
options.Partition = new PartitionDescriptor.Context(context);
31+
options.Partition = new ContextPartitionDescriptor(context);
3232

3333
return storageModule.GetCookiesAsync(options);
3434
}
@@ -37,7 +37,7 @@ public async Task<PartitionKey> DeleteCookiesAsync(DeleteCookiesOptions? options
3737
{
3838
options ??= new();
3939

40-
options.Partition = new PartitionDescriptor.Context(context);
40+
options.Partition = new ContextPartitionDescriptor(context);
4141

4242
var res = await storageModule.DeleteCookiesAsync(options).ConfigureAwait(false);
4343

@@ -48,7 +48,7 @@ public async Task<PartitionKey> SetCookieAsync(PartialCookie cookie, SetCookieOp
4848
{
4949
options ??= new();
5050

51-
options.Partition = new PartitionDescriptor.Context(context);
51+
options.Partition = new ContextPartitionDescriptor(context);
5252

5353
var res = await storageModule.SetCookieAsync(cookie, options).ConfigureAwait(false);
5454

dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,15 @@ public class CookieFilter
8080
}
8181

8282
[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
83-
[JsonDerivedType(typeof(Context), "context")]
84-
[JsonDerivedType(typeof(StorageKey), "storageKey")]
85-
public abstract record PartitionDescriptor
86-
{
87-
public record Context([property: JsonPropertyName("context")] BrowsingContext.BrowsingContext Descriptor) : PartitionDescriptor;
83+
[JsonDerivedType(typeof(ContextPartitionDescriptor), "context")]
84+
[JsonDerivedType(typeof(StorageKeyPartitionDescriptor), "storageKey")]
85+
public abstract record PartitionDescriptor;
8886

89-
public record StorageKey : PartitionDescriptor
90-
{
91-
public string? UserContext { get; set; }
87+
public record ContextPartitionDescriptor(BrowsingContext.BrowsingContext Context) : PartitionDescriptor;
9288

93-
public string? SourceOrigin { get; set; }
94-
}
89+
public record StorageKeyPartitionDescriptor : PartitionDescriptor
90+
{
91+
public string? UserContext { get; set; }
92+
93+
public string? SourceOrigin { get; set; }
9594
}

0 commit comments

Comments
 (0)