Skip to content
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
56 changes: 28 additions & 28 deletions dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Task<GetTreeResult> GetTreeAsync(ContextGetTreeOptions? options = null, C
return BiDi.BrowsingContext.GetTreeAsync(ContextGetTreeOptions.WithContext(options, this), cancellationToken);
}

public Task<Subscription> OnNavigationStartedAsync(Func<NavigationInfo, Task> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnNavigationStartedAsync(Func<NavigationEventArgs, Task> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -132,7 +132,7 @@ public Task<Subscription> OnNavigationStartedAsync(Func<NavigationInfo, Task> ha
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnNavigationStartedAsync(Action<NavigationInfo> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnNavigationStartedAsync(Action<NavigationEventArgs> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -141,7 +141,7 @@ public Task<Subscription> OnNavigationStartedAsync(Action<NavigationInfo> handle
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnFragmentNavigatedAsync(Func<NavigationInfo, Task> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnFragmentNavigatedAsync(Func<NavigationEventArgs, Task> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -150,7 +150,7 @@ public Task<Subscription> OnFragmentNavigatedAsync(Func<NavigationInfo, Task> ha
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnFragmentNavigatedAsync(Action<NavigationInfo> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnFragmentNavigatedAsync(Action<NavigationEventArgs> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -177,7 +177,7 @@ public Task<Subscription> OnHistoryUpdatedAsync(Action<HistoryUpdatedEventArgs>
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnDomContentLoadedAsync(Func<NavigationInfo, Task> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnDomContentLoadedAsync(Func<NavigationEventArgs, Task> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -186,7 +186,7 @@ public Task<Subscription> OnDomContentLoadedAsync(Func<NavigationInfo, Task> han
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnDomContentLoadedAsync(Action<NavigationInfo> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnDomContentLoadedAsync(Action<NavigationEventArgs> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -195,7 +195,7 @@ public Task<Subscription> OnDomContentLoadedAsync(Action<NavigationInfo> handler
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnLoadAsync(Action<NavigationInfo> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnLoadAsync(Action<NavigationEventArgs> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -204,7 +204,7 @@ public Task<Subscription> OnLoadAsync(Action<NavigationInfo> handler, ContextSub
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnLoadAsync(Func<NavigationInfo, Task> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnLoadAsync(Func<NavigationEventArgs, Task> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand Down Expand Up @@ -249,7 +249,7 @@ public Task<Subscription> OnDownloadEndAsync(Func<DownloadEndEventArgs, Task> ha
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnNavigationAbortedAsync(Action<NavigationInfo> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnNavigationAbortedAsync(Action<NavigationEventArgs> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -258,7 +258,7 @@ public Task<Subscription> OnNavigationAbortedAsync(Action<NavigationInfo> handle
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnNavigationAbortedAsync(Func<NavigationInfo, Task> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnNavigationAbortedAsync(Func<NavigationEventArgs, Task> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -267,7 +267,7 @@ public Task<Subscription> OnNavigationAbortedAsync(Func<NavigationInfo, Task> ha
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnNavigationFailedAsync(Action<NavigationInfo> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnNavigationFailedAsync(Action<NavigationEventArgs> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -276,7 +276,7 @@ public Task<Subscription> OnNavigationFailedAsync(Action<NavigationInfo> handler
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnNavigationFailedAsync(Func<NavigationInfo, Task> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnNavigationFailedAsync(Func<NavigationEventArgs, Task> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -285,7 +285,7 @@ public Task<Subscription> OnNavigationFailedAsync(Func<NavigationInfo, Task> han
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnNavigationCommittedAsync(Action<NavigationInfo> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnNavigationCommittedAsync(Action<NavigationEventArgs> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -294,7 +294,7 @@ public Task<Subscription> OnNavigationCommittedAsync(Action<NavigationInfo> hand
ContextSubscriptionOptions.WithContext(options, this));
}

public Task<Subscription> OnNavigationCommittedAsync(Func<NavigationInfo, Task> handler, ContextSubscriptionOptions? options = null)
public Task<Subscription> OnNavigationCommittedAsync(Func<NavigationEventArgs, Task> handler, ContextSubscriptionOptions? options = null)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -303,31 +303,31 @@ public Task<Subscription> OnNavigationCommittedAsync(Func<NavigationInfo, Task>
ContextSubscriptionOptions.WithContext(options, this));
}

private async Task HandleNavigationStartedAsync(NavigationInfo e, Func<NavigationInfo, Task> handler)
private async Task HandleNavigationStartedAsync(NavigationEventArgs e, Func<NavigationEventArgs, Task> handler)
{
if (Equals(e.Context))
{
await handler(e).ConfigureAwait(false);
}
}

private void HandleNavigationStarted(NavigationInfo e, Action<NavigationInfo> handler)
private void HandleNavigationStarted(NavigationEventArgs e, Action<NavigationEventArgs> handler)
{
if (Equals(e.Context))
{
handler(e);
}
}

private async Task HandleFragmentNavigatedAsync(NavigationInfo e, Func<NavigationInfo, Task> handler)
private async Task HandleFragmentNavigatedAsync(NavigationEventArgs e, Func<NavigationEventArgs, Task> handler)
{
if (Equals(e.Context))
{
await handler(e).ConfigureAwait(false);
}
}

private void HandleFragmentNavigated(NavigationInfo e, Action<NavigationInfo> handler)
private void HandleFragmentNavigated(NavigationEventArgs e, Action<NavigationEventArgs> handler)
{
if (Equals(e.Context))
{
Expand All @@ -351,31 +351,31 @@ private void HandleHistoryUpdated(HistoryUpdatedEventArgs e, Action<HistoryUpdat
}
}

private async Task HandleDomContentLoadedAsync(NavigationInfo e, Func<NavigationInfo, Task> handler)
private async Task HandleDomContentLoadedAsync(NavigationEventArgs e, Func<NavigationEventArgs, Task> handler)
{
if (Equals(e.Context))
{
await handler(e).ConfigureAwait(false);
}
}

private void HandleDomContentLoaded(NavigationInfo e, Action<NavigationInfo> handler)
private void HandleDomContentLoaded(NavigationEventArgs e, Action<NavigationEventArgs> handler)
{
if (Equals(e.Context))
{
handler(e);
}
}

private void HandleLoad(NavigationInfo e, Action<NavigationInfo> handler)
private void HandleLoad(NavigationEventArgs e, Action<NavigationEventArgs> handler)
{
if (Equals(e.Context))
{
handler(e);
}
}

private async Task HandleLoadAsync(NavigationInfo e, Func<NavigationInfo, Task> handler)
private async Task HandleLoadAsync(NavigationEventArgs e, Func<NavigationEventArgs, Task> handler)
{
if (Equals(e.Context))
{
Expand Down Expand Up @@ -415,47 +415,47 @@ private async Task HandleDownloadEndAsync(DownloadEndEventArgs e, Func<DownloadE
}
}

private void HandleNavigationAborted(NavigationInfo e, Action<NavigationInfo> handler)
private void HandleNavigationAborted(NavigationEventArgs e, Action<NavigationEventArgs> handler)
{
if (Equals(e.Context))
{
handler(e);
}
}

private async Task HandleNavigationAbortedAsync(NavigationInfo e, Func<NavigationInfo, Task> handler)
private async Task HandleNavigationAbortedAsync(NavigationEventArgs e, Func<NavigationEventArgs, Task> handler)
{
if (Equals(e.Context))
{
await handler(e).ConfigureAwait(false);
}
}

private void HandleNavigationFailed(NavigationInfo e, Action<NavigationInfo> handler)
private void HandleNavigationFailed(NavigationEventArgs e, Action<NavigationEventArgs> handler)
{
if (Equals(e.Context))
{
handler(e);
}
}

private async Task HandleNavigationFailedAsync(NavigationInfo e, Func<NavigationInfo, Task> handler)
private async Task HandleNavigationFailedAsync(NavigationEventArgs e, Func<NavigationEventArgs, Task> handler)
{
if (Equals(e.Context))
{
await handler(e).ConfigureAwait(false);
}
}

private void HandleNavigationCommitted(NavigationInfo e, Action<NavigationInfo> handler)
private void HandleNavigationCommitted(NavigationEventArgs e, Action<NavigationEventArgs> handler)
{
if (Equals(e.Context))
{
handler(e);
}
}

private async Task HandleNavigationCommittedAsync(NavigationInfo e, Func<NavigationInfo, Task> handler)
private async Task HandleNavigationCommittedAsync(NavigationEventArgs e, Func<NavigationEventArgs, Task> handler)
{
if (Equals(e.Context))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// <copyright file="BrowsingContextEventArgs.cs" company="Selenium Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// </copyright>

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record BrowsingContextEventArgs(IReadOnlyList<BrowsingContextInfo>? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent)
: EventArgs;
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record BrowsingContextInfo(IReadOnlyList<BrowsingContextInfo>? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent)
: EventArgs;
public sealed record BrowsingContextInfo(IReadOnlyList<BrowsingContextInfo>? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent);
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Task<SetFilesResult> SetFilesAsync(Script.ISharedReference element, IEnum
return inputModule.SetFilesAsync(context, element, files, options, cancellationToken);
}

public Task<Subscription> OnFileDialogOpenedAsync(Func<FileDialogInfo, Task> handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default)
public Task<Subscription> OnFileDialogOpenedAsync(Func<FileDialogEventArgs, Task> handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -48,7 +48,7 @@ public Task<Subscription> OnFileDialogOpenedAsync(Func<FileDialogInfo, Task> han
cancellationToken);
}

public Task<Subscription> OnFileDialogOpenedAsync(Action<FileDialogInfo> handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default)
public Task<Subscription> OnFileDialogOpenedAsync(Action<FileDialogEventArgs> handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -58,15 +58,15 @@ public Task<Subscription> OnFileDialogOpenedAsync(Action<FileDialogInfo> handler
cancellationToken);
}

private async Task HandleFileDialogOpenedAsync(FileDialogInfo e, Func<FileDialogInfo, Task> handler)
private async Task HandleFileDialogOpenedAsync(FileDialogEventArgs e, Func<FileDialogEventArgs, Task> handler)
{
if (context.Equals(e.Context))
{
await handler(e).ConfigureAwait(false);
}
}

private void HandleFileDialogOpened(FileDialogInfo e, Action<FileDialogInfo> handler)
private void HandleFileDialogOpened(FileDialogEventArgs e, Action<FileDialogEventArgs> handler)
{
if (context.Equals(e.Context))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed class BrowsingContextLogModule(BrowsingContext context, LogModule logModule)
{
public Task<Subscription> OnEntryAddedAsync(Func<Log.LogEntry, Task> handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default)
public Task<Subscription> OnEntryAddedAsync(Func<LogEntryEventArgs, Task> handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -33,7 +33,7 @@ public Task<Subscription> OnEntryAddedAsync(Func<Log.LogEntry, Task> handler, Co
cancellationToken);
}

public Task<Subscription> OnEntryAddedAsync(Action<Log.LogEntry> handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default)
public Task<Subscription> OnEntryAddedAsync(Action<LogEntryEventArgs> handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default)
{
if (handler is null) throw new ArgumentNullException(nameof(handler));

Expand All @@ -43,15 +43,15 @@ public Task<Subscription> OnEntryAddedAsync(Action<Log.LogEntry> handler, Contex
cancellationToken);
}

private async Task HandleEntryAddedAsync(Log.LogEntry e, Func<Log.LogEntry, Task> handler)
private async Task HandleEntryAddedAsync(LogEntryEventArgs e, Func<LogEntryEventArgs, Task> handler)
{
if (context.Equals(e.Source.Context))
{
await handler(e).ConfigureAwait(false);
}
}

private void HandleEntryAdded(Log.LogEntry e, Action<Log.LogEntry> handler)
private void HandleEntryAdded(LogEntryEventArgs e, Action<LogEntryEventArgs> handler)
{
if (context.Equals(e.Source.Context))
{
Expand Down
Loading