Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,33 @@ internal BrowsingContext(BiDi bidi, string id)
{
BiDi = bidi;
Id = id;

_logModule = new Lazy<BrowsingContextLogModule>(() => new BrowsingContextLogModule(this, BiDi.Log));
_networkModule = new Lazy<BrowsingContextNetworkModule>(() => new BrowsingContextNetworkModule(this, BiDi.Network));
_scriptModule = new Lazy<BrowsingContextScriptModule>(() => new BrowsingContextScriptModule(this, BiDi.Script));
_storageModule = new Lazy<BrowsingContextStorageModule>(() => new BrowsingContextStorageModule(this, BiDi.Storage));
_inputModule = new Lazy<BrowsingContextInputModule>(() => new BrowsingContextInputModule(this, BiDi.InputModule));
}

private readonly Lazy<BrowsingContextLogModule> _logModule;
private readonly Lazy<BrowsingContextNetworkModule> _networkModule;
private readonly Lazy<BrowsingContextScriptModule> _scriptModule;
private readonly Lazy<BrowsingContextStorageModule> _storageModule;
private readonly Lazy<BrowsingContextInputModule> _inputModule;
private BrowsingContextLogModule? _logModule;
private BrowsingContextNetworkModule? _networkModule;
private BrowsingContextScriptModule? _scriptModule;
private BrowsingContextStorageModule? _storageModule;
private BrowsingContextInputModule? _inputModule;

internal string Id { get; }

[JsonIgnore]
public BiDi BiDi { get; }

[JsonIgnore]
public BrowsingContextLogModule Log => _logModule.Value;
public BrowsingContextLogModule Log => _logModule ??= new BrowsingContextLogModule(this, BiDi.Log);

[JsonIgnore]
public BrowsingContextNetworkModule Network => _networkModule.Value;
public BrowsingContextNetworkModule Network => _networkModule ??= new BrowsingContextNetworkModule(this, BiDi.Network);

[JsonIgnore]
public BrowsingContextScriptModule Script => _scriptModule.Value;
public BrowsingContextScriptModule Script => _scriptModule ??= new BrowsingContextScriptModule(this, BiDi.Script);

[JsonIgnore]
public BrowsingContextStorageModule Storage => _storageModule.Value;
public BrowsingContextStorageModule Storage => _storageModule ??= new BrowsingContextStorageModule(this, BiDi.Storage);

[JsonIgnore]
public BrowsingContextInputModule Input => _inputModule.Value;
public BrowsingContextInputModule Input => _inputModule ??= new BrowsingContextInputModule(this, BiDi.InputModule);

public Task<NavigateResult> NavigateAsync(string url, NavigateOptions? options = null)
{
Expand Down