Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into v21
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok committed Dec 26, 2024
2 parents 52e52d0 + 1459dbe commit 3946d92
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,6 @@ A massive thanks to [JetBrains](https://www.jetbrains.com/?from=PuppeteerSharp)

And a huge thanks to everyone who sponsors this project through [Github sponsors](https://github.com/sponsors/hardkoded):

<!-- sponsors --><a href="https://github.com/tolgabalci"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;2467618?u&#x3D;8ed50176b40b4e869c95c4c53137ab6a8a5fe1b1&amp;v&#x3D;4" width="60px" alt="Tolga Balci" /></a><a href="https://github.com/nogginbox"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;729381?v&#x3D;4" width="60px" alt="Richard Garside" /></a><!-- sponsors -->
<!-- sponsors --><a href="https://github.com/tolgabalci"><img src="https:&#x2F;&#x2F;github.com&#x2F;tolgabalci.png" width="60px" alt="User avatar: Tolga Balci" /></a><a href="https://github.com/nogginbox"><img src="https:&#x2F;&#x2F;github.com&#x2F;nogginbox.png" width="60px" alt="User avatar: Richard Garside" /></a><!-- sponsors -->


7 changes: 6 additions & 1 deletion lib/PuppeteerSharp/Cdp/CdpElementHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ public class CdpElementHandle : ElementHandle

internal CdpElementHandle(
IsolatedWorld world,
RemoteObject remoteObject) : base(world, remoteObject)
RemoteObject remoteObject)
{
Handle = new CdpJSHandle(world, remoteObject);
Logger = Realm.Environment.Client.Connection.LoggerFactory.CreateLogger(GetType());
_cdpFrame = Realm.Frame as CdpFrame;
}

/// <inheritdoc />
public override RemoteObject RemoteObject => Handle.RemoteObject;

internal override IsolatedWorld Realm => Handle.Realm;

/// <summary>
/// Logger.
/// </summary>
Expand Down
9 changes: 8 additions & 1 deletion lib/PuppeteerSharp/Cdp/CdpJSHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ namespace PuppeteerSharp.Cdp;
/// <inheritdoc/>
public class CdpJSHandle : JSHandle
{
internal CdpJSHandle(IsolatedWorld world, RemoteObject remoteObject) : base(world, remoteObject)
internal CdpJSHandle(IsolatedWorld world, RemoteObject remoteObject)
{
Realm = world;
RemoteObject = remoteObject;
Logger = Client.Connection.LoggerFactory.CreateLogger(GetType());
}

/// <inheritdoc/>
public override RemoteObject RemoteObject { get; }

internal override IsolatedWorld Realm { get; }

/// <summary>
/// Logger.
/// </summary>
Expand Down
4 changes: 1 addition & 3 deletions lib/PuppeteerSharp/ElementHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ public abstract class ElementHandle : JSHandle, IElementHandle
{
private ElementHandle _isolatedHandle;

internal ElementHandle(
IsolatedWorld world,
RemoteObject remoteObject) : base(world, remoteObject)
internal ElementHandle()
{
}

Expand Down
7 changes: 7 additions & 0 deletions lib/PuppeteerSharp/IsExternalInit.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#if !NETSTANDARD2_0
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsExternalInit))]
#else
using System.ComponentModel;

namespace System.Runtime.CompilerServices
{
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit
{
}
}
#endif
8 changes: 3 additions & 5 deletions lib/PuppeteerSharp/JSHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@ namespace PuppeteerSharp
/// <inheritdoc/>
public abstract class JSHandle : IJSHandle
{
internal JSHandle(IsolatedWorld world, RemoteObject remoteObject)
internal JSHandle()
{
Realm = world;
RemoteObject = remoteObject;
}

/// <inheritdoc/>
public bool Disposed { get; protected set; }

/// <inheritdoc/>
public RemoteObject RemoteObject { get; }
public abstract RemoteObject RemoteObject { get; }

internal Func<Task> DisposeAction { get; set; }

internal IsolatedWorld Realm { get; }
internal abstract IsolatedWorld Realm { get; }

internal Frame Frame => Realm.Environment as Frame;

Expand Down

0 comments on commit 3946d92

Please sign in to comment.