Skip to content

[dotnet] [bidi] Make PartitionDescriptor as not nested #15435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Task<GetCookiesResult> GetCookiesAsync(GetCookiesOptions? options = null)
{
options ??= new();

options.Partition = new PartitionDescriptor.Context(context);
options.Partition = new ContextPartitionDescriptor(context);

return storageModule.GetCookiesAsync(options);
}
Expand All @@ -37,7 +37,7 @@ public async Task<PartitionKey> DeleteCookiesAsync(DeleteCookiesOptions? options
{
options ??= new();

options.Partition = new PartitionDescriptor.Context(context);
options.Partition = new ContextPartitionDescriptor(context);

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

Expand All @@ -48,7 +48,7 @@ public async Task<PartitionKey> 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);

Expand Down
19 changes: 9 additions & 10 deletions dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Loading