Skip to content

Commit 94b6b49

Browse files
committed
Decouple Realm from FrameManager
1 parent e20afd2 commit 94b6b49

File tree

5 files changed

+14
-19
lines changed

5 files changed

+14
-19
lines changed

lib/PuppeteerSharp/Cdp/CdpFrame.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,13 @@ internal void UpdateClient(CDPSession client, bool keepWorlds = false)
317317
MainRealm = new IsolatedWorld(
318318
this,
319319
null,
320-
FrameManager.TimeoutSettings,
320+
Page.DefaultTimeout,
321321
true);
322322

323323
IsolatedRealm = new IsolatedWorld(
324324
this,
325325
null,
326-
FrameManager.TimeoutSettings,
326+
Page.DefaultTimeout,
327327
false);
328328
}
329329
else

lib/PuppeteerSharp/Cdp/CdpWebWorker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal CdpWebWorker(
5050
_id = targetId;
5151
Client = client;
5252
_targetType = targetType;
53-
World = new IsolatedWorld(null, this, new TimeoutSettings(), true);
53+
World = new IsolatedWorld(null, this, Puppeteer.DefaultTimeout, true);
5454
_consoleAPICalled = consoleAPICalled;
5555
_exceptionThrown = exceptionThrown;
5656
client.MessageReceived += OnMessageReceived;

lib/PuppeteerSharp/IsolatedWorld.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ internal class IsolatedWorld : Realm, IDisposable, IAsyncDisposable
3030
public IsolatedWorld(
3131
Frame frame,
3232
WebWorker worker,
33-
TimeoutSettings timeoutSettings,
34-
bool isMainWorld) : base(timeoutSettings)
33+
int timeout,
34+
bool isMainWorld) : base(timeout)
3535
{
3636
Frame = frame;
3737
Worker = worker;

lib/PuppeteerSharp/PuppeteerSharp.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
<Description>Headless Browser .NET API</Description>
1313
<PackageId>PuppeteerSharp</PackageId>
1414
<PackageReleaseNotes></PackageReleaseNotes>
15-
<PackageVersion>20.2.2</PackageVersion>
16-
<ReleaseVersion>20.2.2</ReleaseVersion>
17-
<AssemblyVersion>20.2.2</AssemblyVersion>
18-
<FileVersion>20.2.2</FileVersion>
15+
<PackageVersion>20.2.3</PackageVersion>
16+
<ReleaseVersion>20.2.3</ReleaseVersion>
17+
<AssemblyVersion>20.2.3</AssemblyVersion>
18+
<FileVersion>20.2.3</FileVersion>
1919
<SynchReleaseVersion>false</SynchReleaseVersion>
2020
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
2121
<DebugType>embedded</DebugType>

lib/PuppeteerSharp/Realm.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33

44
namespace PuppeteerSharp
55
{
6-
internal abstract class Realm
6+
internal abstract class Realm(int timeout)
77
{
8-
public Realm(TimeoutSettings timeoutSettings)
9-
{
10-
TimeoutSettings = timeoutSettings;
11-
}
12-
13-
internal TaskManager TaskManager { get; set; } = new();
8+
internal TaskManager TaskManager { get; } = new();
149

15-
internal TimeoutSettings TimeoutSettings { get; }
10+
internal int Timeout { get; } = timeout;
1611

1712
internal abstract IEnvironment Environment { get; }
1813

@@ -42,7 +37,7 @@ internal async Task<IJSHandle> WaitForFunctionAsync(string script, WaitForFuncti
4237
false,
4338
options.Polling,
4439
options.PollingInterval,
45-
options.Timeout ?? TimeoutSettings.Timeout,
40+
options.Timeout ?? Timeout,
4641
options.Root,
4742
args);
4843

@@ -59,7 +54,7 @@ internal async Task<IJSHandle> WaitForExpressionAsync(string script, WaitForFunc
5954
true,
6055
options.Polling,
6156
options.PollingInterval,
62-
options.Timeout ?? TimeoutSettings.Timeout,
57+
options.Timeout ?? Timeout,
6358
null, // Root
6459
null); // args
6560

0 commit comments

Comments
 (0)