Skip to content

Commit 73f4de2

Browse files
authored
Remove IsIncognito and some obsolete fields (#2738)
1 parent dcce7ed commit 73f4de2

File tree

9 files changed

+3
-106
lines changed

9 files changed

+3
-106
lines changed

lib/PuppeteerSharp.DevicesFetcher/Program.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@ public static class DeviceDescriptors
7171
new Lazy<IReadOnlyDictionary<DeviceDescriptorName, DeviceDescriptor>>(() => new ReadOnlyDictionary<DeviceDescriptorName, DeviceDescriptor>(Devices));
7272
7373
internal static IReadOnlyDictionary<DeviceDescriptorName, DeviceDescriptor> ToReadOnly() => _readOnlyDevices.Value;
74-
75-
/// <summary>
76-
/// Get the specified device description.
77-
/// </summary>
78-
/// <returns>The device descriptor.</returns>
79-
/// <param name=""name"">Device Name.</param>
80-
[Obsolete(""Use Puppeteer.Devices instead"")]
81-
public static DeviceDescriptor Get(DeviceDescriptorName name) => Devices[name];
8274
}
8375
}";
8476

lib/PuppeteerSharp.Tests/BrowserContextTests/BrowserContextTests.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ public void ShouldHaveDefaultContext()
1313
{
1414
Assert.That(Browser.BrowserContexts(), Has.Exactly(1).Items);
1515
var defaultContext = Browser.BrowserContexts()[0];
16-
#pragma warning disable CS0618 // Type or member is obsolete
17-
Assert.That(defaultContext.IsIncognito, Is.False);
18-
#pragma warning restore CS0618 // Type or member is obsolete
1916
var exception = Assert.ThrowsAsync<PuppeteerException>(defaultContext.CloseAsync);
2017
Assert.That(Browser.DefaultContext, Is.SameAs(defaultContext));
2118
Assert.That(exception!.Message, Does.Contain("cannot be closed"));
@@ -26,9 +23,6 @@ public async Task ShouldCreateNewIncognitoContext()
2623
{
2724
Assert.That(Browser.BrowserContexts(), Has.Exactly(1).Items);
2825
var context = await Browser.CreateBrowserContextAsync();
29-
#pragma warning disable CS0618 // Type or member is obsolete
30-
Assert.That(context.IsIncognito, Is.True);
31-
#pragma warning restore CS0618 // Type or member is obsolete
3226
Assert.That(Browser.BrowserContexts(), Has.Length.EqualTo(2));
3327
Assert.That(Browser.BrowserContexts(), Does.Contain(context));
3428
await context.CloseAsync();

lib/PuppeteerSharp/BrowserContext.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public abstract class BrowserContext : IBrowserContext
2020
/// <inheritdoc/>
2121
public string Id { get; protected init; }
2222

23-
/// <inheritdoc/>
24-
public bool IsIncognito => Id != null;
25-
2623
/// <inheritdoc/>
2724
public bool IsClosed => !Browser.BrowserContexts().Contains(this);
2825

lib/PuppeteerSharp/ChromiumProcessException.cs

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

lib/PuppeteerSharp/ConnectOptions.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ public class ConnectOptions : IBrowserOptions, IConnectionOptions
1515
/// </summary>
1616
public bool AcceptInsecureCerts { get; set; }
1717

18-
/// <summary>
19-
/// If set to true, sets Headless = false, otherwise, enables automation.
20-
/// </summary>
21-
[Obsolete("No longer required and usages should be removed")]
22-
public bool AppMode { get; set; }
23-
2418
/// <summary>
2519
/// A browser websocket endpoint to connect to.
2620
/// </summary>
@@ -37,12 +31,6 @@ public class ConnectOptions : IBrowserOptions, IConnectionOptions
3731
/// </summary>
3832
public int SlowMo { get; set; }
3933

40-
/// <summary>
41-
/// Keep alive value.
42-
/// </summary>
43-
[Obsolete("Chromium doesn't support pings yet (see: https://bugs.chromium.org/p/chromium/issues/detail?id=865002)")]
44-
public int KeepAliveInterval { get; set; } = 0;
45-
4634
/// <summary>
4735
/// Optional factory for <see cref="WebSocket"/> implementations.
4836
/// If <see cref="Transport"/> is set this property will be ignored.
@@ -55,12 +43,6 @@ public class ConnectOptions : IBrowserOptions, IConnectionOptions
5543
/// <value>The default Viewport.</value>
5644
public ViewPortOptions DefaultViewport { get; set; } = ViewPortOptions.Default;
5745

58-
/// <summary>
59-
/// Optional connection transport.
60-
/// </summary>
61-
[Obsolete("Use " + nameof(TransportFactory) + " instead")]
62-
public IConnectionTransport Transport { get; set; }
63-
6446
/// <summary>
6547
/// Optional factory for <see cref="IConnectionTransport"/> implementations.
6648
/// </summary>

lib/PuppeteerSharp/IBrowserContext.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ public interface IBrowserContext
4040
/// </summary>
4141
bool IsClosed { get; }
4242

43-
/// <summary>
44-
/// Returns whether BrowserContext is incognito
45-
/// The default browser context is the only non-incognito browser context.
46-
/// </summary>
47-
/// <remarks>
48-
/// The default browser context cannot be closed.
49-
/// </remarks>
50-
[Obsolete("In Chrome, the default browser context can also be \"icognito\" if configured via the arguments and in such cases this getter returns wrong results. Also, the term \"incognito\" is not applicable to other browsers. To migrate, check the default browser context instead: in Chrome all non-default contexts are incognito, and the default context might be incognito if you provide the `--incognito` argument when launching the browser.")]
51-
bool IsIncognito { get; }
52-
5343
/// <summary>
5444
/// Clears all permission overrides for the browser context.
5545
/// </summary>

lib/PuppeteerSharp/LaunchOptions.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ public bool Devtools
9191
}
9292
}
9393

94-
/// <summary>
95-
/// Keep alive value.
96-
/// </summary>
97-
[Obsolete("Chromium doesn't support pings yet (see: https://bugs.chromium.org/p/chromium/issues/detail?id=865002)")]
98-
public int KeepAliveInterval { get; set; } = 0;
99-
10094
/// <summary>
10195
/// Logs process counts after launching chrome and after exiting.
10296
/// </summary>
@@ -151,12 +145,6 @@ public string[] IgnoredDefaultArgs
151145
/// </remarks>
152146
public WebSocketFactory WebSocketFactory { get; set; }
153147

154-
/// <summary>
155-
/// Optional connection transport.
156-
/// </summary>
157-
[Obsolete("Use " + nameof(TransportFactory) + " instead")]
158-
public IConnectionTransport Transport { get; set; }
159-
160148
/// <summary>
161149
/// Optional factory for <see cref="IConnectionTransport"/> implementations.
162150
/// </summary>

lib/PuppeteerSharp/Mobile/DeviceDescriptors.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace PuppeteerSharp.Mobile
99
/// </summary>
1010
public static class DeviceDescriptors
1111
{
12-
private static readonly Dictionary<DeviceDescriptorName, DeviceDescriptor> Devices = new Dictionary<DeviceDescriptorName, DeviceDescriptor>
12+
private static readonly Dictionary<DeviceDescriptorName, DeviceDescriptor> _devices = new()
1313
{
1414
[DeviceDescriptorName.BlackberryPlayBook] = new DeviceDescriptor
1515
{
@@ -1232,15 +1232,7 @@ public static class DeviceDescriptors
12321232
};
12331233

12341234
private static readonly Lazy<IReadOnlyDictionary<DeviceDescriptorName, DeviceDescriptor>> _readOnlyDevices =
1235-
new Lazy<IReadOnlyDictionary<DeviceDescriptorName, DeviceDescriptor>>(() => new ReadOnlyDictionary<DeviceDescriptorName, DeviceDescriptor>(Devices));
1236-
1237-
/// <summary>
1238-
/// Get the specified device description.
1239-
/// </summary>
1240-
/// <returns>The device descriptor.</returns>
1241-
/// <param name="name">Device Name.</param>
1242-
[Obsolete("Use Puppeteer.Devices instead")]
1243-
public static DeviceDescriptor Get(DeviceDescriptorName name) => Devices[name];
1235+
new(() => new ReadOnlyDictionary<DeviceDescriptorName, DeviceDescriptor>(_devices));
12441236

12451237
internal static IReadOnlyDictionary<DeviceDescriptorName, DeviceDescriptor> ToReadOnly() => _readOnlyDevices.Value;
12461238
}

lib/PuppeteerSharp/ProcessException.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ namespace PuppeteerSharp
55
/// <summary>
66
/// process exception thrown by <see cref="Launcher"/>.
77
/// </summary>
8-
#pragma warning disable 612, 618
98
[Serializable]
10-
public class ProcessException : ChromiumProcessException
11-
#pragma warning restore 612, 618
9+
public class ProcessException : Exception
1210
{
1311
/// <summary>
1412
/// Initializes a new instance of the <see cref="ProcessException"/> class.

0 commit comments

Comments
 (0)