internal void ContextDestroyed(FrameExecutionContext context) { foreach (var contextType in _contextData.Keys) { var data = _contextData[contextType]; if (data.Context == context) { SetContext(contextType, null); } } }
internal void ContextCreated(ContextType contextType, FrameExecutionContext context) { var data = _contextData[contextType]; // In case of multiple sessions to the same target, there's a race between // connections so we might end up creating multiple isolated worlds. // We can use either. if (data.Context != null) { SetContext(contextType, null); } SetContext(contextType, context); }
private void SetContext(ContextType contextType, FrameExecutionContext context) { var data = _contextData[contextType]; data.Context = context; if (context != null) { data.ContextTsc.TrySetResult(context); foreach (var rerunnableTask in data.RerunnableTasks) { _ = rerunnableTask.RerunAsync(context); } } else { data.ContextTsc = new TaskCompletionSource <FrameExecutionContext>(); } }
internal ElementHandle(FrameExecutionContext context, IRemoteObject remoteObject) : base(context, remoteObject) { Page = context.Frame.Page; Context = context; }