Skip to content

Commit 8316072

Browse files
committed
Move BrowsingContext
1 parent aa9d591 commit 8316072

File tree

3 files changed

+41
-47
lines changed

3 files changed

+41
-47
lines changed

dotnet/src/webdriver/BiDi/Browser/BrowserModule.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace OpenQA.Selenium.BiDi.Browser;
2727

2828
public sealed class BrowserModule : Module
2929
{
30-
private JsonSerializerContext _jsonContext = null!;
30+
private BrowserModuleJsonSerializerContext _jsonContext = null!;
3131

3232
public async Task<EmptyResult> CloseAsync(CloseOptions? options = null)
3333
{
@@ -81,10 +81,13 @@ public async Task<EmptyResult> SetDownloadBehaviorDeniedAsync(SetDownloadBehavio
8181

8282
protected internal override void Initialize(JsonSerializerOptions options)
8383
{
84-
_jsonContext = new BrowserModuleJsonSerializerContext(options);
84+
_jsonContext = new(options);
8585
}
8686
}
8787

88+
[JsonSerializable(typeof(Command))]
89+
[JsonSerializable(typeof(EmptyResult))]
90+
8891
[JsonSerializable(typeof(CloseCommand))]
8992
[JsonSerializable(typeof(CreateUserContextCommand))]
9093
[JsonSerializable(typeof(GetUserContextsCommand))]

dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext;
2828

2929
public sealed class BrowsingContextModule : Module
3030
{
31-
private JsonSerializerContext _jsonContext = null!;
31+
private BrowsingContextModuleJsonSerializerContext _jsonContext = null!;
3232

3333
public async Task<BrowsingContext> CreateAsync(ContextType type, CreateOptions? options = null)
3434
{
@@ -258,6 +258,40 @@ public async Task<Subscription> OnUserPromptClosedAsync(Action<UserPromptClosedE
258258

259259
protected internal override void Initialize(JsonSerializerOptions options)
260260
{
261-
_jsonContext = new BiDiJsonSerializerContext(options);
261+
_jsonContext = new(options);
262262
}
263263
}
264+
265+
[JsonSerializable(typeof(Command))]
266+
[JsonSerializable(typeof(EmptyResult))]
267+
268+
[JsonSerializable(typeof(ActivateCommand))]
269+
[JsonSerializable(typeof(CaptureScreenshotCommand))]
270+
[JsonSerializable(typeof(CaptureScreenshotResult))]
271+
[JsonSerializable(typeof(CloseCommand))]
272+
[JsonSerializable(typeof(CreateCommand))]
273+
[JsonSerializable(typeof(CreateResult))]
274+
[JsonSerializable(typeof(GetTreeCommand))]
275+
[JsonSerializable(typeof(GetTreeResult))]
276+
[JsonSerializable(typeof(HandleUserPromptCommand))]
277+
[JsonSerializable(typeof(LocateNodesCommand))]
278+
[JsonSerializable(typeof(LocateNodesResult))]
279+
[JsonSerializable(typeof(NavigateCommand))]
280+
[JsonSerializable(typeof(NavigateResult))]
281+
[JsonSerializable(typeof(PrintCommand))]
282+
[JsonSerializable(typeof(PrintResult))]
283+
[JsonSerializable(typeof(ReloadCommand))]
284+
[JsonSerializable(typeof(SetViewportCommand))]
285+
[JsonSerializable(typeof(TraverseHistoryCommand))]
286+
[JsonSerializable(typeof(TraverseHistoryResult))]
287+
288+
[JsonSerializable(typeof(BrowsingContextInfo))]
289+
[JsonSerializable(typeof(DownloadWillBeginEventArgs))]
290+
[JsonSerializable(typeof(DownloadEndEventArgs))]
291+
[JsonSerializable(typeof(DownloadCanceledEventArgs))]
292+
[JsonSerializable(typeof(DownloadCompleteEventArgs))]
293+
[JsonSerializable(typeof(HistoryUpdatedEventArgs))]
294+
[JsonSerializable(typeof(NavigationInfo))]
295+
[JsonSerializable(typeof(UserPromptOpenedEventArgs))]
296+
[JsonSerializable(typeof(UserPromptClosedEventArgs))]
297+
internal partial class BrowsingContextModuleJsonSerializerContext : JsonSerializerContext;

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

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -79,49 +79,6 @@ namespace OpenQA.Selenium.BiDi.Communication.Json;
7979
[JsonSerializable(typeof(Session.SubscribeResult))]
8080
[JsonSerializable(typeof(Session.UnsubscribeByIdCommand))]
8181

82-
[JsonSerializable(typeof(Browser.CloseCommand), TypeInfoPropertyName = "Browser_CloseCommand")]
83-
[JsonSerializable(typeof(Browser.CreateUserContextCommand))]
84-
[JsonSerializable(typeof(Browser.GetUserContextsCommand))]
85-
[JsonSerializable(typeof(Browser.GetUserContextsResult))]
86-
[JsonSerializable(typeof(Browser.RemoveUserContextCommand))]
87-
[JsonSerializable(typeof(Browser.GetClientWindowsCommand))]
88-
[JsonSerializable(typeof(Browser.GetClientWindowsResult))]
89-
[JsonSerializable(typeof(Browser.SetDownloadBehaviorCommand))]
90-
[JsonSerializable(typeof(Browser.UserContextInfo))]
91-
[JsonSerializable(typeof(IReadOnlyList<Browser.UserContextInfo>))]
92-
[JsonSerializable(typeof(IReadOnlyList<Browser.ClientWindowInfo>))]
93-
94-
95-
[JsonSerializable(typeof(BrowsingContext.ActivateCommand))]
96-
[JsonSerializable(typeof(BrowsingContext.CaptureScreenshotCommand))]
97-
[JsonSerializable(typeof(BrowsingContext.CaptureScreenshotResult))]
98-
[JsonSerializable(typeof(BrowsingContext.CloseCommand), TypeInfoPropertyName = "BrowsingContext_CloseCommand")]
99-
[JsonSerializable(typeof(BrowsingContext.CreateCommand))]
100-
[JsonSerializable(typeof(BrowsingContext.CreateResult))]
101-
[JsonSerializable(typeof(BrowsingContext.GetTreeCommand))]
102-
[JsonSerializable(typeof(BrowsingContext.GetTreeResult))]
103-
[JsonSerializable(typeof(BrowsingContext.HandleUserPromptCommand))]
104-
[JsonSerializable(typeof(BrowsingContext.LocateNodesCommand))]
105-
[JsonSerializable(typeof(BrowsingContext.LocateNodesResult))]
106-
[JsonSerializable(typeof(BrowsingContext.NavigateCommand))]
107-
[JsonSerializable(typeof(BrowsingContext.NavigateResult))]
108-
[JsonSerializable(typeof(BrowsingContext.PrintCommand))]
109-
[JsonSerializable(typeof(BrowsingContext.PrintResult))]
110-
[JsonSerializable(typeof(BrowsingContext.ReloadCommand))]
111-
[JsonSerializable(typeof(BrowsingContext.SetViewportCommand))]
112-
[JsonSerializable(typeof(BrowsingContext.TraverseHistoryCommand))]
113-
[JsonSerializable(typeof(BrowsingContext.TraverseHistoryResult))]
114-
115-
[JsonSerializable(typeof(BrowsingContext.BrowsingContextInfo))]
116-
[JsonSerializable(typeof(BrowsingContext.DownloadWillBeginEventArgs))]
117-
[JsonSerializable(typeof(BrowsingContext.DownloadEndEventArgs))]
118-
[JsonSerializable(typeof(BrowsingContext.DownloadCanceledEventArgs))]
119-
[JsonSerializable(typeof(BrowsingContext.DownloadCompleteEventArgs))]
120-
[JsonSerializable(typeof(BrowsingContext.HistoryUpdatedEventArgs))]
121-
[JsonSerializable(typeof(BrowsingContext.NavigationInfo))]
122-
[JsonSerializable(typeof(BrowsingContext.UserPromptOpenedEventArgs))]
123-
[JsonSerializable(typeof(BrowsingContext.UserPromptClosedEventArgs))]
124-
12582
[JsonSerializable(typeof(Network.AddDataCollectorCommand))]
12683
[JsonSerializable(typeof(Network.AddDataCollectorResult))]
12784
[JsonSerializable(typeof(Network.AddInterceptCommand))]

0 commit comments

Comments
 (0)