Skip to content

Commit 474fee2

Browse files
authored
Merge branch 'trunk' into dotnet-bidi-ienumerable
2 parents b029580 + e6d99a3 commit 474fee2

File tree

4 files changed

+45
-77
lines changed

4 files changed

+45
-77
lines changed

common/repositories.bzl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ js_library(
123123

124124
pkg_archive(
125125
name = "mac_edge",
126-
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/2aa012fa-b45e-4235-8fcf-9d42087a962c/MicrosoftEdge-141.0.3537.57.pkg",
127-
sha256 = "af6ae5d5fe1d4ff9113168817d1c0f4edd1b2499ca58b4f92ae5172516d4d79f",
126+
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/2f00e9c7-bb79-4501-aab6-5530c081aa92/MicrosoftEdge-141.0.3537.71.pkg",
127+
sha256 = "3b88bf987cfd9c49b2a90ed8f881b66c6cb921152e2f5d22f187e94a5e2f0405",
128128
move = {
129-
"MicrosoftEdge-141.0.3537.57.pkg/Payload/Microsoft Edge.app": "Edge.app",
129+
"MicrosoftEdge-141.0.3537.71.pkg/Payload/Microsoft Edge.app": "Edge.app",
130130
},
131131
build_file_content = """
132132
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -143,8 +143,8 @@ js_library(
143143

144144
deb_archive(
145145
name = "linux_edge",
146-
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_141.0.3537.57-1_amd64.deb",
147-
sha256 = "c6a1eee8e741e81149562f9899026332387b09b2f69bd76b50782d4551c186b9",
146+
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_141.0.3537.71-1_amd64.deb",
147+
sha256 = "f91edceb1301a66a55c5492bf50f5ec0819b198f33e5945ee36dacc68b8fcdf2",
148148
build_file_content = """
149149
load("@aspect_rules_js//js:defs.bzl", "js_library")
150150
package(default_visibility = ["//visibility:public"])
@@ -165,8 +165,8 @@ js_library(
165165

166166
http_archive(
167167
name = "linux_edgedriver",
168-
url = "https://msedgedriver.microsoft.com/141.0.3537.57/edgedriver_linux64.zip",
169-
sha256 = "54536daa3e18ba9504cd85c5b2a02f8d963dfba0c90208b9a46f4b59e0de50ae",
168+
url = "https://msedgedriver.microsoft.com/141.0.3537.71/edgedriver_linux64.zip",
169+
sha256 = "9b91c97b8157a1b709a43db5df3a66b059a5c807280c4591c73e50d85b73dc91",
170170
build_file_content = """
171171
load("@aspect_rules_js//js:defs.bzl", "js_library")
172172
package(default_visibility = ["//visibility:public"])
@@ -182,8 +182,8 @@ js_library(
182182

183183
http_archive(
184184
name = "mac_edgedriver",
185-
url = "https://msedgedriver.microsoft.com/141.0.3537.57/edgedriver_mac64.zip",
186-
sha256 = "d939d0c08797db9510ca5b1022cb3cfe0aafeb11a4e4195ec65cae7bc791fb44",
185+
url = "https://msedgedriver.microsoft.com/141.0.3537.71/edgedriver_mac64.zip",
186+
sha256 = "c0c544ba7472016cc2fb2bfaf580d5735951a1f768a251831aa98483655ecf68",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])
@@ -199,8 +199,8 @@ js_library(
199199

200200
http_archive(
201201
name = "linux_chrome",
202-
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.54/linux64/chrome-linux64.zip",
203-
sha256 = "5023ec2b8995b74caa5de0e22d5e30f871c3ecce67a6e52d3c9f9dfed423ed01",
202+
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.76/linux64/chrome-linux64.zip",
203+
sha256 = "ed9ae9c5767aee31757ad866ce059e3ecb337802e9e6388094012f243dcbb3fa",
204204
build_file_content = """
205205
load("@aspect_rules_js//js:defs.bzl", "js_library")
206206
package(default_visibility = ["//visibility:public"])
@@ -220,8 +220,8 @@ js_library(
220220
)
221221
http_archive(
222222
name = "mac_chrome",
223-
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.54/mac-x64/chrome-mac-x64.zip",
224-
sha256 = "9d6b740d792d1d9e51198f98176813a5d1962c763a09cd708053b5aa3dfaa5df",
223+
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.76/mac-x64/chrome-mac-x64.zip",
224+
sha256 = "e04744a286a74bdd6eff77c0f815718e6ba5d132f38374851b67acc5ba69d988",
225225
strip_prefix = "chrome-mac-x64",
226226
patch_cmds = [
227227
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -241,8 +241,8 @@ js_library(
241241
)
242242
http_archive(
243243
name = "linux_chromedriver",
244-
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.54/linux64/chromedriver-linux64.zip",
245-
sha256 = "98b142a6342b8481084876a4e6747a291762641d9016b10c0178a24959fb6d03",
244+
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.76/linux64/chromedriver-linux64.zip",
245+
sha256 = "a4b7b6fa36f1e74cdaa9518f0ce874e35c23c959a8ac37419261d8cd3be70085",
246246
strip_prefix = "chromedriver-linux64",
247247
build_file_content = """
248248
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -259,8 +259,8 @@ js_library(
259259

260260
http_archive(
261261
name = "mac_chromedriver",
262-
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.54/mac-x64/chromedriver-mac-x64.zip",
263-
sha256 = "1140ed8fa9408c09968823ce20703b1303500789b6ce334056635eb477591dca",
262+
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.76/mac-x64/chromedriver-mac-x64.zip",
263+
sha256 = "44a1cb3ffd95c9682cd7781240eda81540211749fc68790a82ed0aacf6fe2293",
264264
strip_prefix = "chromedriver-mac-x64",
265265
build_file_content = """
266266
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -277,8 +277,8 @@ js_library(
277277

278278
http_archive(
279279
name = "linux_beta_chrome",
280-
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.6/linux64/chrome-linux64.zip",
281-
sha256 = "999f72fd31d3d351f08c2170f4734bd3674fd772417f567c243eabd0ab70bcb2",
280+
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.23/linux64/chrome-linux64.zip",
281+
sha256 = "8cfb9247d87419bd750c68b6f29424ad91474e0ee848c3f3cde04da76fbf9c2e",
282282
build_file_content = """
283283
load("@aspect_rules_js//js:defs.bzl", "js_library")
284284
package(default_visibility = ["//visibility:public"])
@@ -298,8 +298,8 @@ js_library(
298298
)
299299
http_archive(
300300
name = "mac_beta_chrome",
301-
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.6/mac-x64/chrome-mac-x64.zip",
302-
sha256 = "b85a318a5cd3fa83b7ef4034dc643d134f475a6fe305d3d65af58310bc36fc9f",
301+
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.23/mac-x64/chrome-mac-x64.zip",
302+
sha256 = "2024bc564c4e7e26514b8cb4740d9f3760b2f8545d573c0ba08bd2ed3f6fd85f",
303303
strip_prefix = "chrome-mac-x64",
304304
patch_cmds = [
305305
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -319,8 +319,8 @@ js_library(
319319
)
320320
http_archive(
321321
name = "linux_beta_chromedriver",
322-
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.6/linux64/chromedriver-linux64.zip",
323-
sha256 = "da19a48eca2e7a09d757003eda2e814c8b7a9db462301faccc24564e5e593eca",
322+
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.23/linux64/chromedriver-linux64.zip",
323+
sha256 = "6309f4601340d2a0c8df04e239a4696f1f5427be8e53545a2a321b640be2a0de",
324324
strip_prefix = "chromedriver-linux64",
325325
build_file_content = """
326326
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -337,8 +337,8 @@ js_library(
337337

338338
http_archive(
339339
name = "mac_beta_chromedriver",
340-
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.6/mac-x64/chromedriver-mac-x64.zip",
341-
sha256 = "156dc49c7f1707c72b670182d63fc2e6414734950221ba5c2fc133f580ed3713",
340+
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.23/mac-x64/chromedriver-mac-x64.zip",
341+
sha256 = "695d4c4d71f31df7ea9d8bfccd19075662212b7fed9f9487fa2fa2aaa790faa6",
342342
strip_prefix = "chromedriver-mac-x64",
343343
build_file_content = """
344344
load("@aspect_rules_js//js:defs.bzl", "js_library")

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public sealed class Broker : IAsyncDisposable
3838
private readonly ITransport _transport;
3939

4040
private readonly ConcurrentDictionary<long, CommandInfo> _pendingCommands = new();
41-
private readonly BlockingCollection<MessageEvent> _pendingEvents = [];
41+
private readonly BlockingCollection<(string Method, EventArgs Params)> _pendingEvents = [];
4242
private readonly Dictionary<string, JsonTypeInfo> _eventTypesMap = [];
4343

4444
private readonly ConcurrentDictionary<string, List<EventHandler>> _eventHandlers = new();
@@ -143,20 +143,20 @@ public async Task<TResult> ExecuteCommandAsync<TCommand, TResult>(TCommand comma
143143
where TResult : EmptyResult
144144
{
145145
command.Id = Interlocked.Increment(ref _currentCommandId);
146-
var tcs = new TaskCompletionSource<JsonElement>(TaskCreationOptions.RunContinuationsAsynchronously);
146+
var tcs = new TaskCompletionSource<EmptyResult>(TaskCreationOptions.RunContinuationsAsynchronously);
147147
var timeout = options?.Timeout ?? TimeSpan.FromSeconds(30);
148148
using var cts = new CancellationTokenSource(timeout);
149149
cts.Token.Register(() => tcs.TrySetCanceled(cts.Token));
150-
var commandInfo = new CommandInfo(command.Id, command.ResultType, tcs);
150+
var commandInfo = new CommandInfo(command.Id, tcs, jsonResultTypeInfo);
151151
_pendingCommands[command.Id] = commandInfo;
152152
var data = JsonSerializer.SerializeToUtf8Bytes(command, jsonCommandTypeInfo);
153153

154154
await _transport.SendAsync(data, cts.Token).ConfigureAwait(false);
155-
var resultJson = await tcs.Task.ConfigureAwait(false);
156-
return JsonSerializer.Deserialize(resultJson, jsonResultTypeInfo)!;
155+
156+
return (TResult)await tcs.Task.ConfigureAwait(false);
157157
}
158158

159-
public async Task<Subscription> SubscribeAsync<TEventArgs>(string eventName, Action<TEventArgs> action, SubscriptionOptions? options, JsonTypeInfo jsonTypeInfo)
159+
public async Task<Subscription> SubscribeAsync<TEventArgs>(string eventName, Action<TEventArgs> action, SubscriptionOptions? options, JsonTypeInfo<TEventArgs> jsonTypeInfo)
160160
where TEventArgs : EventArgs
161161
{
162162
_eventTypesMap[eventName] = jsonTypeInfo;
@@ -185,7 +185,7 @@ public async Task<Subscription> SubscribeAsync<TEventArgs>(string eventName, Act
185185
}
186186
}
187187

188-
public async Task<Subscription> SubscribeAsync<TEventArgs>(string eventName, Func<TEventArgs, Task> func, SubscriptionOptions? options, JsonTypeInfo jsonTypeInfo)
188+
public async Task<Subscription> SubscribeAsync<TEventArgs>(string eventName, Func<TEventArgs, Task> func, SubscriptionOptions? options, JsonTypeInfo<TEventArgs> jsonTypeInfo)
189189
where TEventArgs : EventArgs
190190
{
191191
_eventTypesMap[eventName] = jsonTypeInfo;
@@ -301,7 +301,7 @@ private void ProcessReceivedMessage(byte[]? data)
301301

302302
if (_pendingCommands.TryGetValue(id.Value, out var successCommand))
303303
{
304-
successCommand.TaskCompletionSource.SetResult(JsonElement.ParseValue(ref resultReader));
304+
successCommand.TaskCompletionSource.SetResult((EmptyResult)JsonSerializer.Deserialize(ref resultReader, successCommand.JsonResultTypeInfo)!);
305305
_pendingCommands.TryRemove(id.Value, out _);
306306
}
307307
else
@@ -318,7 +318,7 @@ private void ProcessReceivedMessage(byte[]? data)
318318
{
319319
var eventArgs = (EventArgs)JsonSerializer.Deserialize(ref paramsReader, eventInfo)!;
320320

321-
var messageEvent = new MessageEvent(method, eventArgs);
321+
var messageEvent = (method, eventArgs);
322322
_pendingEvents.Add(messageEvent);
323323
}
324324
else
@@ -345,10 +345,12 @@ private void ProcessReceivedMessage(byte[]? data)
345345
}
346346
}
347347

348-
class CommandInfo(long id, Type resultType, TaskCompletionSource<JsonElement> taskCompletionSource)
348+
class CommandInfo(long id, TaskCompletionSource<EmptyResult> taskCompletionSource, JsonTypeInfo jsonResultTypeInfo)
349349
{
350350
public long Id { get; } = id;
351351

352-
public TaskCompletionSource<JsonElement> TaskCompletionSource { get; } = taskCompletionSource;
352+
public TaskCompletionSource<EmptyResult> TaskCompletionSource { get; } = taskCompletionSource;
353+
354+
public JsonTypeInfo JsonResultTypeInfo { get; } = jsonResultTypeInfo;
353355
};
354356
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@
2323

2424
namespace OpenQA.Selenium.BiDi.Communication;
2525

26-
public abstract class EventHandler(string eventName, Type eventArgsType, IEnumerable<BrowsingContext.BrowsingContext>? contexts = null)
26+
public abstract class EventHandler(string eventName, IEnumerable<BrowsingContext.BrowsingContext>? contexts = null)
2727
{
2828
public string EventName { get; } = eventName;
29-
public Type EventArgsType { get; set; } = eventArgsType;
29+
3030
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; } = contexts;
3131

32-
public abstract ValueTask InvokeAsync(object args);
32+
public abstract ValueTask InvokeAsync(EventArgs args);
3333
}
3434

3535
internal class AsyncEventHandler<TEventArgs>(string eventName, Func<TEventArgs, Task> func, IEnumerable<BrowsingContext.BrowsingContext>? contexts = null)
36-
: EventHandler(eventName, typeof(TEventArgs), contexts) where TEventArgs : EventArgs
36+
: EventHandler(eventName, contexts) where TEventArgs : EventArgs
3737
{
3838
private readonly Func<TEventArgs, Task> _func = func;
3939

40-
public override async ValueTask InvokeAsync(object args)
40+
public override async ValueTask InvokeAsync(EventArgs args)
4141
{
4242
await _func((TEventArgs)args).ConfigureAwait(false);
4343
}
4444
}
4545

4646
internal class SyncEventHandler<TEventArgs>(string eventName, Action<TEventArgs> action, IEnumerable<BrowsingContext.BrowsingContext>? contexts = null)
47-
: EventHandler(eventName, typeof(TEventArgs), contexts) where TEventArgs : EventArgs
47+
: EventHandler(eventName, contexts) where TEventArgs : EventArgs
4848
{
4949
private readonly Action<TEventArgs> _action = action;
5050

51-
public override ValueTask InvokeAsync(object args)
51+
public override ValueTask InvokeAsync(EventArgs args)
5252
{
5353
_action((TEventArgs)args);
5454

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)