From ae55a9ffe77145b44bb042fa6f852e6da3c9935a Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Tue, 4 Oct 2022 12:53:00 +1000 Subject: [PATCH] DevTools Client - Reorder optional params - Fix compiler error, the generated code now always includes optional params at the end - And overload for LoadNetworkResourceAsync has been added to avoid a breaking change --- CefSharp/DevTools/DevToolsClient.Generated.cs | 96 +++++++++---------- .../DevToolsClient.Generated.netcore.cs | 96 +++++++++---------- CefSharp/DevTools/DevToolsClient.Partial.cs | 30 ++++++ CefSharp/DevTools/TargetFilter.cs | 23 +++++ 4 files changed, 149 insertions(+), 96 deletions(-) create mode 100644 CefSharp/DevTools/TargetFilter.cs diff --git a/CefSharp/DevTools/DevToolsClient.Generated.cs b/CefSharp/DevTools/DevToolsClient.Generated.cs index 5e4bdbc55..401dceeb4 100644 --- a/CefSharp/DevTools/DevToolsClient.Generated.cs +++ b/CefSharp/DevTools/DevToolsClient.Generated.cs @@ -38225,19 +38225,21 @@ namespace CefSharp.DevTools.IndexedDB _client = (client); } - partial void ValidateClearObjectStore(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName); + partial void ValidateClearObjectStore(string databaseName, string objectStoreName, string securityOrigin = null, string storageKey = null); /// /// Clears all entries from an object store. /// - /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. - /// Storage key. /// Database name. /// Object store name. + /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. + /// Storage key. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> - public System.Threading.Tasks.Task ClearObjectStoreAsync(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName) + public System.Threading.Tasks.Task ClearObjectStoreAsync(string databaseName, string objectStoreName, string securityOrigin = null, string storageKey = null) { - ValidateClearObjectStore(securityOrigin, storageKey, databaseName, objectStoreName); + ValidateClearObjectStore(databaseName, objectStoreName, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -38248,23 +38250,22 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); - dict.Add("objectStoreName", objectStoreName); return _client.ExecuteDevToolsMethodAsync("IndexedDB.clearObjectStore", dict); } - partial void ValidateDeleteDatabase(string securityOrigin = null, string storageKey, string databaseName); + partial void ValidateDeleteDatabase(string databaseName, string securityOrigin = null, string storageKey = null); /// /// Deletes a database. /// + /// Database name. /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. /// Storage key. - /// Database name. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> - public System.Threading.Tasks.Task DeleteDatabaseAsync(string securityOrigin = null, string storageKey, string databaseName) + public System.Threading.Tasks.Task DeleteDatabaseAsync(string databaseName, string securityOrigin = null, string storageKey = null) { - ValidateDeleteDatabase(securityOrigin, storageKey, databaseName); + ValidateDeleteDatabase(databaseName, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -38275,24 +38276,26 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); return _client.ExecuteDevToolsMethodAsync("IndexedDB.deleteDatabase", dict); } - partial void ValidateDeleteObjectStoreEntries(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange); + partial void ValidateDeleteObjectStoreEntries(string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange, string securityOrigin = null, string storageKey = null); /// /// Delete a range of entries from an object store /// - /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. - /// Storage key. /// databaseName /// objectStoreName /// Range of entry keys to delete + /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. + /// Storage key. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> - public System.Threading.Tasks.Task DeleteObjectStoreEntriesAsync(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange) + public System.Threading.Tasks.Task DeleteObjectStoreEntriesAsync(string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange, string securityOrigin = null, string storageKey = null) { - ValidateDeleteObjectStoreEntries(securityOrigin, storageKey, databaseName, objectStoreName, keyRange); + ValidateDeleteObjectStoreEntries(databaseName, objectStoreName, keyRange, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); + dict.Add("keyRange", keyRange.ToDictionary()); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -38303,9 +38306,6 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); - dict.Add("objectStoreName", objectStoreName); - dict.Add("keyRange", keyRange.ToDictionary()); return _client.ExecuteDevToolsMethodAsync("IndexedDB.deleteObjectStoreEntries", dict); } @@ -38329,23 +38329,28 @@ namespace CefSharp.DevTools.IndexedDB return _client.ExecuteDevToolsMethodAsync("IndexedDB.enable", dict); } - partial void ValidateRequestData(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null); + partial void ValidateRequestData(string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, string securityOrigin = null, string storageKey = null, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null); /// /// Requests data from object store or index. /// - /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. - /// Storage key. /// Database name. /// Object store name. /// Index name, empty string for object store data requests. /// Number of records to skip. /// Number of records to fetch. + /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. + /// Storage key. /// Key range. /// returns System.Threading.Tasks.Task<RequestDataResponse> - public System.Threading.Tasks.Task RequestDataAsync(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null) + public System.Threading.Tasks.Task RequestDataAsync(string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, string securityOrigin = null, string storageKey = null, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null) { - ValidateRequestData(securityOrigin, storageKey, databaseName, objectStoreName, indexName, skipCount, pageSize, keyRange); + ValidateRequestData(databaseName, objectStoreName, indexName, skipCount, pageSize, securityOrigin, storageKey, keyRange); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); + dict.Add("indexName", indexName); + dict.Add("skipCount", skipCount); + dict.Add("pageSize", pageSize); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -38356,11 +38361,6 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); - dict.Add("objectStoreName", objectStoreName); - dict.Add("indexName", indexName); - dict.Add("skipCount", skipCount); - dict.Add("pageSize", pageSize); if ((keyRange) != (null)) { dict.Add("keyRange", keyRange.ToDictionary()); @@ -38369,19 +38369,21 @@ namespace CefSharp.DevTools.IndexedDB return _client.ExecuteDevToolsMethodAsync("IndexedDB.requestData", dict); } - partial void ValidateGetMetadata(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName); + partial void ValidateGetMetadata(string databaseName, string objectStoreName, string securityOrigin = null, string storageKey = null); /// /// Gets metadata of an object store /// - /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. - /// Storage key. /// Database name. /// Object store name. + /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. + /// Storage key. /// returns System.Threading.Tasks.Task<GetMetadataResponse> - public System.Threading.Tasks.Task GetMetadataAsync(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName) + public System.Threading.Tasks.Task GetMetadataAsync(string databaseName, string objectStoreName, string securityOrigin = null, string storageKey = null) { - ValidateGetMetadata(securityOrigin, storageKey, databaseName, objectStoreName); + ValidateGetMetadata(databaseName, objectStoreName, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -38392,23 +38394,22 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); - dict.Add("objectStoreName", objectStoreName); return _client.ExecuteDevToolsMethodAsync("IndexedDB.getMetadata", dict); } - partial void ValidateRequestDatabase(string securityOrigin = null, string storageKey, string databaseName); + partial void ValidateRequestDatabase(string databaseName, string securityOrigin = null, string storageKey = null); /// /// Requests database with given name in given frame. /// + /// Database name. /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. /// Storage key. - /// Database name. /// returns System.Threading.Tasks.Task<RequestDatabaseResponse> - public System.Threading.Tasks.Task RequestDatabaseAsync(string securityOrigin = null, string storageKey, string databaseName) + public System.Threading.Tasks.Task RequestDatabaseAsync(string databaseName, string securityOrigin = null, string storageKey = null) { - ValidateRequestDatabase(securityOrigin, storageKey, databaseName); + ValidateRequestDatabase(databaseName, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -38419,7 +38420,6 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); return _client.ExecuteDevToolsMethodAsync("IndexedDB.requestDatabase", dict); } @@ -41387,25 +41387,25 @@ namespace CefSharp.DevTools.Network return _client.ExecuteDevToolsMethodAsync("Network.enableReportingApi", dict); } - partial void ValidateLoadNetworkResource(string frameId, string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options); + partial void ValidateLoadNetworkResource(string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options, string frameId = null); /// /// Fetches the resource and returns the content. /// - /// Frame id to get the resource for. Mandatory for frame targets, andshould be omitted for worker targets. /// URL of the resource to get content for. /// Options for the request. + /// Frame id to get the resource for. Mandatory for frame targets, andshould be omitted for worker targets. /// returns System.Threading.Tasks.Task<LoadNetworkResourceResponse> - public System.Threading.Tasks.Task LoadNetworkResourceAsync(string frameId, string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options) + public System.Threading.Tasks.Task LoadNetworkResourceAsync(string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options, string frameId = null) { - ValidateLoadNetworkResource(frameId, url, options); + ValidateLoadNetworkResource(url, options, frameId); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("url", url); + dict.Add("options", options.ToDictionary()); if (!(string.IsNullOrEmpty(frameId))) { dict.Add("frameId", frameId); } - dict.Add("url", url); - dict.Add("options", options.ToDictionary()); return _client.ExecuteDevToolsMethodAsync("Network.loadNetworkResource", dict); } } diff --git a/CefSharp/DevTools/DevToolsClient.Generated.netcore.cs b/CefSharp/DevTools/DevToolsClient.Generated.netcore.cs index 75e7d6e92..dfa299b52 100644 --- a/CefSharp/DevTools/DevToolsClient.Generated.netcore.cs +++ b/CefSharp/DevTools/DevToolsClient.Generated.netcore.cs @@ -35392,19 +35392,21 @@ namespace CefSharp.DevTools.IndexedDB _client = (client); } - partial void ValidateClearObjectStore(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName); + partial void ValidateClearObjectStore(string databaseName, string objectStoreName, string securityOrigin = null, string storageKey = null); /// /// Clears all entries from an object store. /// - /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. - /// Storage key. /// Database name. /// Object store name. + /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. + /// Storage key. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> - public System.Threading.Tasks.Task ClearObjectStoreAsync(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName) + public System.Threading.Tasks.Task ClearObjectStoreAsync(string databaseName, string objectStoreName, string securityOrigin = null, string storageKey = null) { - ValidateClearObjectStore(securityOrigin, storageKey, databaseName, objectStoreName); + ValidateClearObjectStore(databaseName, objectStoreName, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -35415,23 +35417,22 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); - dict.Add("objectStoreName", objectStoreName); return _client.ExecuteDevToolsMethodAsync("IndexedDB.clearObjectStore", dict); } - partial void ValidateDeleteDatabase(string securityOrigin = null, string storageKey, string databaseName); + partial void ValidateDeleteDatabase(string databaseName, string securityOrigin = null, string storageKey = null); /// /// Deletes a database. /// + /// Database name. /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. /// Storage key. - /// Database name. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> - public System.Threading.Tasks.Task DeleteDatabaseAsync(string securityOrigin = null, string storageKey, string databaseName) + public System.Threading.Tasks.Task DeleteDatabaseAsync(string databaseName, string securityOrigin = null, string storageKey = null) { - ValidateDeleteDatabase(securityOrigin, storageKey, databaseName); + ValidateDeleteDatabase(databaseName, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -35442,24 +35443,26 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); return _client.ExecuteDevToolsMethodAsync("IndexedDB.deleteDatabase", dict); } - partial void ValidateDeleteObjectStoreEntries(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange); + partial void ValidateDeleteObjectStoreEntries(string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange, string securityOrigin = null, string storageKey = null); /// /// Delete a range of entries from an object store /// - /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. - /// Storage key. /// databaseName /// objectStoreName /// Range of entry keys to delete + /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. + /// Storage key. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> - public System.Threading.Tasks.Task DeleteObjectStoreEntriesAsync(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange) + public System.Threading.Tasks.Task DeleteObjectStoreEntriesAsync(string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange, string securityOrigin = null, string storageKey = null) { - ValidateDeleteObjectStoreEntries(securityOrigin, storageKey, databaseName, objectStoreName, keyRange); + ValidateDeleteObjectStoreEntries(databaseName, objectStoreName, keyRange, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); + dict.Add("keyRange", keyRange.ToDictionary()); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -35470,9 +35473,6 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); - dict.Add("objectStoreName", objectStoreName); - dict.Add("keyRange", keyRange.ToDictionary()); return _client.ExecuteDevToolsMethodAsync("IndexedDB.deleteObjectStoreEntries", dict); } @@ -35496,23 +35496,28 @@ namespace CefSharp.DevTools.IndexedDB return _client.ExecuteDevToolsMethodAsync("IndexedDB.enable", dict); } - partial void ValidateRequestData(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null); + partial void ValidateRequestData(string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, string securityOrigin = null, string storageKey = null, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null); /// /// Requests data from object store or index. /// - /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. - /// Storage key. /// Database name. /// Object store name. /// Index name, empty string for object store data requests. /// Number of records to skip. /// Number of records to fetch. + /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. + /// Storage key. /// Key range. /// returns System.Threading.Tasks.Task<RequestDataResponse> - public System.Threading.Tasks.Task RequestDataAsync(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null) + public System.Threading.Tasks.Task RequestDataAsync(string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, string securityOrigin = null, string storageKey = null, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null) { - ValidateRequestData(securityOrigin, storageKey, databaseName, objectStoreName, indexName, skipCount, pageSize, keyRange); + ValidateRequestData(databaseName, objectStoreName, indexName, skipCount, pageSize, securityOrigin, storageKey, keyRange); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); + dict.Add("indexName", indexName); + dict.Add("skipCount", skipCount); + dict.Add("pageSize", pageSize); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -35523,11 +35528,6 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); - dict.Add("objectStoreName", objectStoreName); - dict.Add("indexName", indexName); - dict.Add("skipCount", skipCount); - dict.Add("pageSize", pageSize); if ((keyRange) != (null)) { dict.Add("keyRange", keyRange.ToDictionary()); @@ -35536,19 +35536,21 @@ namespace CefSharp.DevTools.IndexedDB return _client.ExecuteDevToolsMethodAsync("IndexedDB.requestData", dict); } - partial void ValidateGetMetadata(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName); + partial void ValidateGetMetadata(string databaseName, string objectStoreName, string securityOrigin = null, string storageKey = null); /// /// Gets metadata of an object store /// - /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. - /// Storage key. /// Database name. /// Object store name. + /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. + /// Storage key. /// returns System.Threading.Tasks.Task<GetMetadataResponse> - public System.Threading.Tasks.Task GetMetadataAsync(string securityOrigin = null, string storageKey, string databaseName, string objectStoreName) + public System.Threading.Tasks.Task GetMetadataAsync(string databaseName, string objectStoreName, string securityOrigin = null, string storageKey = null) { - ValidateGetMetadata(securityOrigin, storageKey, databaseName, objectStoreName); + ValidateGetMetadata(databaseName, objectStoreName, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -35559,23 +35561,22 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); - dict.Add("objectStoreName", objectStoreName); return _client.ExecuteDevToolsMethodAsync("IndexedDB.getMetadata", dict); } - partial void ValidateRequestDatabase(string securityOrigin = null, string storageKey, string databaseName); + partial void ValidateRequestDatabase(string databaseName, string securityOrigin = null, string storageKey = null); /// /// Requests database with given name in given frame. /// + /// Database name. /// At least and at most one of securityOrigin, storageKey must be specified.Security origin. /// Storage key. - /// Database name. /// returns System.Threading.Tasks.Task<RequestDatabaseResponse> - public System.Threading.Tasks.Task RequestDatabaseAsync(string securityOrigin = null, string storageKey, string databaseName) + public System.Threading.Tasks.Task RequestDatabaseAsync(string databaseName, string securityOrigin = null, string storageKey = null) { - ValidateRequestDatabase(securityOrigin, storageKey, databaseName); + ValidateRequestDatabase(databaseName, securityOrigin, storageKey); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseName", databaseName); if (!(string.IsNullOrEmpty(securityOrigin))) { dict.Add("securityOrigin", securityOrigin); @@ -35586,7 +35587,6 @@ namespace CefSharp.DevTools.IndexedDB dict.Add("storageKey", storageKey); } - dict.Add("databaseName", databaseName); return _client.ExecuteDevToolsMethodAsync("IndexedDB.requestDatabase", dict); } @@ -38351,25 +38351,25 @@ namespace CefSharp.DevTools.Network return _client.ExecuteDevToolsMethodAsync("Network.enableReportingApi", dict); } - partial void ValidateLoadNetworkResource(string frameId, string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options); + partial void ValidateLoadNetworkResource(string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options, string frameId = null); /// /// Fetches the resource and returns the content. /// - /// Frame id to get the resource for. Mandatory for frame targets, andshould be omitted for worker targets. /// URL of the resource to get content for. /// Options for the request. + /// Frame id to get the resource for. Mandatory for frame targets, andshould be omitted for worker targets. /// returns System.Threading.Tasks.Task<LoadNetworkResourceResponse> - public System.Threading.Tasks.Task LoadNetworkResourceAsync(string frameId, string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options) + public System.Threading.Tasks.Task LoadNetworkResourceAsync(string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options, string frameId = null) { - ValidateLoadNetworkResource(frameId, url, options); + ValidateLoadNetworkResource(url, options, frameId); var dict = new System.Collections.Generic.Dictionary(); + dict.Add("url", url); + dict.Add("options", options.ToDictionary()); if (!(string.IsNullOrEmpty(frameId))) { dict.Add("frameId", frameId); } - dict.Add("url", url); - dict.Add("options", options.ToDictionary()); return _client.ExecuteDevToolsMethodAsync("Network.loadNetworkResource", dict); } } diff --git a/CefSharp/DevTools/DevToolsClient.Partial.cs b/CefSharp/DevTools/DevToolsClient.Partial.cs index 2f0de8374..6a0f6266b 100644 --- a/CefSharp/DevTools/DevToolsClient.Partial.cs +++ b/CefSharp/DevTools/DevToolsClient.Partial.cs @@ -17,3 +17,33 @@ namespace CefSharp.DevTools.Page } } } + +namespace CefSharp.DevTools.Network +{ + public partial class NetworkClient + { + /// + /// Fetches the resource and returns the content. + /// + /// Frame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets. + /// URL of the resource to get content for. + /// Options for the request. + /// returns System.Threading.Tasks.Task<LoadNetworkResourceResponse> + /// + /// This overload of LoadNetworkResourceAsync exists to avoid a breaking change as optional params are now always at the end + /// where previously they weren't marked as optional when at the beginning. + /// + public System.Threading.Tasks.Task LoadNetworkResourceAsync(string frameId, string url, CefSharp.DevTools.Network.LoadNetworkResourceOptions options) + { + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(frameId))) + { + dict.Add("frameId", frameId); + } + + dict.Add("url", url); + dict.Add("options", options.ToDictionary()); + return _client.ExecuteDevToolsMethodAsync("Network.loadNetworkResource", dict); + } + } +} diff --git a/CefSharp/DevTools/TargetFilter.cs b/CefSharp/DevTools/TargetFilter.cs new file mode 100644 index 000000000..bb1d798e5 --- /dev/null +++ b/CefSharp/DevTools/TargetFilter.cs @@ -0,0 +1,23 @@ +// Copyright © 2022 The CefSharp Authors. All rights reserved. +// +// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. + +namespace CefSharp.DevTools.Target +{ + /// + /// The entries in TargetFilter are matched sequentially against targets and the first entry that matches + /// determines if the target is included or not, depending on the value of exclude field in the entry. + /// If filter is not specified, the one assumed is [{type: "browser", exclude: true}, {type: "tab", exclude: true}, {}] (i.e. include everything but browser and tab). + /// + public class TargetFilter : DevToolsDomainEntityBase + { + /// + /// Type + /// + public string Type { get; set; } + /// + /// Exclude + /// + public bool Exclude { get; set; } + } +}