private void DisposeJavascriptExecutors(string[] executorsKeys) { foreach (var executorKey in executorsKeys) { var indexedExecutorKey = executorKey ?? ""; if (JsExecutors.TryGetValue(indexedExecutorKey, out var executor)) { executor.Dispose(); JsExecutors.Remove(indexedExecutorKey); } } }
private JavascriptExecutor GetJavascriptExecutor(string frameName) { if (isDisposing) { return(null); } lock (JsExecutors) { if (isDisposing) { return(null); } var frameNameForIndex = frameName ?? ""; if (!JsExecutors.TryGetValue(frameNameForIndex, out var jsExecutor)) { jsExecutor = new JavascriptExecutor(this, this.GetFrame(frameName)); JsExecutors.Add(frameNameForIndex, jsExecutor); } return(jsExecutor); } }