public EngineInstance(IWindow window, IDictionary <String, Object> assignments) { var logger = default(IConsoleLogger); var context = window.Document.Context; var createLogger = context.Configuration.Services.OfType <Func <IBrowsingContext, IConsoleLogger> >().FirstOrDefault(); if (createLogger != null) { logger = createLogger.Invoke(context); } _objects = new Dictionary <Object, DomNodeInstance>(); _engine = new Engine(); _engine.SetValue("console", new ConsoleInstance(_engine, logger)); foreach (var assignment in assignments) { _engine.SetValue(assignment.Key, assignment.Value); } _window = GetDomNode(window); _lexicals = LexicalEnvironment.NewObjectEnvironment(_engine, _window, _engine.ExecutionContext.LexicalEnvironment, true); _variables = LexicalEnvironment.NewObjectEnvironment(_engine, _engine.Global, null, false); _constructors = new DomConstructors(this); _constructors.Configure(); this.AddConstructors(_window, typeof(INode)); this.AddConstructors(_window, this.GetType()); this.AddInstances(_window, this.GetType()); }
public EngineInstance(IWindow window, IDictionary<String, Object> assignments) { _objects = new Dictionary<Object, DomNodeInstance>(); _engine = new Engine(); _engine.SetValue("console", new ConsoleInstance(_engine)); foreach (var assignment in assignments) _engine.SetValue(assignment.Key, assignment.Value); _window = GetDomNode(window); _lexicals = LexicalEnvironment.NewObjectEnvironment(_engine, _window, _engine.ExecutionContext.LexicalEnvironment, true); _variables = LexicalEnvironment.NewObjectEnvironment(_engine, _engine.Global, null, false); _constructors = new DomConstructors(this); _constructors.Configure(); this.AddConstructors(_window, typeof(INode)); this.AddConstructors(_window, this.GetType()); }
public EngineInstance(IWindow window, IDictionary <String, Object> assignments) { _objects = new Dictionary <Object, DomNodeInstance>(); _engine = new Engine(); _engine.SetValue("console", new ConsoleInstance(_engine)); foreach (var assignment in assignments) { _engine.SetValue(assignment.Key, assignment.Value); } _window = GetDomNode(window); _lexicals = LexicalEnvironment.NewObjectEnvironment(_engine, _window, _engine.ExecutionContext.LexicalEnvironment, true); _variables = LexicalEnvironment.NewObjectEnvironment(_engine, _engine.Global, null, false); _constructors = new DomConstructors(this); _constructors.Configure(); this.AddConstructors(_window, typeof(INode)); this.AddConstructors(_window, this.GetType()); }