Skip to content

Commit 25da920

Browse files
committed
[dotnet] [biti] Remove obsolete unsubscribing by attributes
1 parent 3a34d66 commit 25da920

File tree

4 files changed

+1
-39
lines changed

4 files changed

+1
-39
lines changed

dotnet/src/webdriver/BiDi/Communication/Broker.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -275,27 +275,7 @@ public async Task UnsubscribeAsync(Session.Subscription subscription, EventHandl
275275

276276
eventHandlers.Remove(eventHandler);
277277

278-
if (subscription is not null)
279-
{
280-
await _bidi.SessionModule.UnsubscribeAsync([subscription]).ConfigureAwait(false);
281-
}
282-
else
283-
{
284-
if (eventHandler.Contexts is not null)
285-
{
286-
if (!eventHandlers.Any(h => eventHandler.Contexts.Equals(h.Contexts)) && !eventHandlers.Any(h => h.Contexts is null))
287-
{
288-
await _bidi.SessionModule.UnsubscribeAsync([eventHandler.EventName], new() { Contexts = eventHandler.Contexts }).ConfigureAwait(false);
289-
}
290-
}
291-
else
292-
{
293-
if (!eventHandlers.Any(h => h.Contexts is not null) && !eventHandlers.Any(h => h.Contexts is null))
294-
{
295-
await _bidi.SessionModule.UnsubscribeAsync([eventHandler.EventName]).ConfigureAwait(false);
296-
}
297-
}
298-
}
278+
await _bidi.SessionModule.UnsubscribeAsync([subscription]).ConfigureAwait(false);
299279
}
300280

301281
public async ValueTask DisposeAsync()

dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ namespace OpenQA.Selenium.BiDi.Communication.Json;
7878
[JsonSerializable(typeof(Session.SubscribeCommand))]
7979
[JsonSerializable(typeof(Session.SubscribeResult))]
8080
[JsonSerializable(typeof(Session.UnsubscribeByIdCommand))]
81-
[JsonSerializable(typeof(Session.UnsubscribeByAttributesCommand))]
8281

8382
[JsonSerializable(typeof(Browser.CloseCommand), TypeInfoPropertyName = "Browser_CloseCommand")]
8483
[JsonSerializable(typeof(Browser.CreateUserContextCommand))]

dotnet/src/webdriver/BiDi/Session/SessionModule.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ public async Task<EmptyResult> UnsubscribeAsync(IEnumerable<Subscription> subscr
4444
return await Broker.ExecuteCommandAsync<UnsubscribeByIdCommand, EmptyResult>(new UnsubscribeByIdCommand(@params), options).ConfigureAwait(false);
4545
}
4646

47-
public async Task<EmptyResult> UnsubscribeAsync(IEnumerable<string> eventNames, UnsubscribeByAttributesOptions? options = null)
48-
{
49-
var @params = new UnsubscribeByAttributesParameters(eventNames, options?.Contexts);
50-
51-
return await Broker.ExecuteCommandAsync<UnsubscribeByAttributesCommand, EmptyResult>(new UnsubscribeByAttributesCommand(@params), options).ConfigureAwait(false);
52-
}
53-
5447
public async Task<NewResult> NewAsync(CapabilitiesRequest capabilitiesRequest, NewOptions? options = null)
5548
{
5649
var @params = new NewParameters(capabilitiesRequest);

dotnet/src/webdriver/BiDi/Session/UnsubscribeCommand.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,17 @@
1818
// </copyright>
1919

2020
using OpenQA.Selenium.BiDi.Communication;
21-
using System;
2221
using System.Collections.Generic;
2322

2423
namespace OpenQA.Selenium.BiDi.Session;
2524

2625
internal sealed class UnsubscribeByIdCommand(UnsubscribeByIdParameters @params)
2726
: Command<UnsubscribeByIdParameters, EmptyResult>(@params, "session.unsubscribe");
2827

29-
internal sealed class UnsubscribeByAttributesCommand(UnsubscribeByAttributesParameters @params)
30-
: Command<UnsubscribeByAttributesParameters, EmptyResult>(@params, "session.unsubscribe");
31-
3228
internal sealed record UnsubscribeByIdParameters(IEnumerable<Subscription> Subscriptions) : Parameters;
3329

3430
public sealed class UnsubscribeByIdOptions : CommandOptions;
3531

36-
internal sealed record UnsubscribeByAttributesParameters(
37-
IEnumerable<string> Events,
38-
[property: Obsolete("Contexts param is deprecated and will be removed in the future versions")]
39-
// https://w3c.github.io/webdriver-bidi/#type-session-UnsubscribeByAttributesRequest
40-
IEnumerable<BrowsingContext.BrowsingContext>? Contexts) : Parameters;
41-
4232
public sealed class UnsubscribeByAttributesOptions : CommandOptions
4333
{
4434
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; set; }

0 commit comments

Comments
 (0)