Exemplo n.º 1
0
 internal BrowsingContext(IConfiguration configuration, Sandboxes security)
 {
     _configuration = configuration;
     _security = security;
     _loader = this.CreateLoader();
     _history = this.CreateHistory();
 }
Exemplo n.º 2
0
 internal BrowsingContext(IEnumerable <Object> services, Sandboxes security)
     : this(security)
 {
     _services.AddRange(services);
     _originalServices = services;
     _history          = GetService <IHistory>();
 }
Exemplo n.º 3
0
 internal BrowsingContext(IConfiguration configuration, Sandboxes security)
 {
     _configuration = configuration;
     _security      = security;
     _loader        = this.CreateService <IDocumentLoader>();
     _history       = this.CreateService <IHistory>();
 }
Exemplo n.º 4
0
 internal BrowsingContext(IConfiguration configuration, Sandboxes security)
 {
     _configuration = configuration;
     _security      = security;
     _loader        = this.CreateLoader();
     _history       = this.CreateHistory();
 }
Exemplo n.º 5
0
 private BrowsingContext(Sandboxes security)
 {
     _services         = new List <Object>();
     _originalServices = _services;
     _security         = security;
     _children         = new Dictionary <String, WeakReference <IBrowsingContext> >();
 }
Exemplo n.º 6
0
 internal BrowsingContext(IConfiguration configuration, Sandboxes security)
 {
     _configuration = configuration;
     _security = security;
     _loader = this.CreateService<IDocumentLoader>();
     _history = this.CreateService<IHistory>();
 }
Exemplo n.º 7
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();

        sandboxes             = new Sandboxes();
        sandboxes[TAG_MASTER] = master = new Listeners();
    }
 internal BrowsingContext(IBrowsingContext parent, Sandboxes security)
     : this(security)
 {
     _parent  = parent;
     _creator = _parent.Active;
     _history = GetService <IHistory>();
 }
Exemplo n.º 9
0
 internal Document(IBrowsingContext context, TextSource source)
     : base(null, "#document", NodeType.Document)
 {
     Referrer            = String.Empty;
     ContentType         = MimeTypeNames.ApplicationXml;
     _attachedReferences = new List <WeakReference>();
     _async             = true;
     _designMode        = false;
     _firedUnload       = false;
     _salvageable       = true;
     _shown             = false;
     _context           = context;
     _source            = source;
     _ready             = DocumentReadyState.Loading;
     _sandbox           = Sandboxes.None;
     _quirksMode        = QuirksMode.Off;
     _loadingScripts    = new Queue <HtmlScriptElement>();
     _location          = new Location("about:blank");
     _location.Changed += LocationChanged;
     _view              = new Window(this);
     _loader            = context.CreateService <IResourceLoader>();
     _loop              = context.CreateService <IEventLoop>();
     _mutations         = new MutationHost(_loop);
     _statusCode        = HttpStatusCode.OK;
 }
Exemplo n.º 10
0
        /// <summary>
        /// Creates a new named browsing context as child of the given parent.
        /// </summary>
        /// <param name="parent">The parent context.</param>
        /// <param name="name">The name of the child context.</param>
        /// <param name="security">The security flags to apply.</param>
        /// <returns></returns>
        public IBrowsingContext Create(IBrowsingContext parent, String name, Sandboxes security)
        {
            var context = new BrowsingContext(parent, security);

            _cache[name] = new WeakReference <IBrowsingContext>(context);
            return(context);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Creates a new nested browsing context with the given name and
        /// creator.
        /// </summary>
        /// <param name="document">The creator of the context.</param>
        /// <param name="security">The sandbox flag of the context.</param>
        /// <returns>The new nesteted context.</returns>
        public static IBrowsingContext NewChildContext(this Document document, Sandboxes security)
        {
            //TODO
            var context = document.NewContext(String.Empty, security);

            document.AttachReference(context);
            return(context);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Creates a new named browsing context as child of the given parent.
        /// </summary>
        /// <param name="name">The name of the child context, if any.</param>
        /// <param name="security">The security flags to apply.</param>
        /// <returns></returns>
        public IBrowsingContext CreateChild(String name, Sandboxes security)
        {
            var context = new BrowsingContext(this, security);

            if (!String.IsNullOrEmpty(name))
            {
                _children[name] = new WeakReference <IBrowsingContext>(context);
            }

            return(context);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Creates a new browsing context without any name.
        /// </summary>
        /// <param name="options">The configuration to use.</param>
        /// <param name="security">The sandboxing flag to use.</param>
        /// <returns>The new context.</returns>
        public static IBrowsingContext NewContext(this IConfiguration options, Sandboxes security)
        {
            var service = options.GetService <IContextService>();

            if (service == null)
            {
                return(new SimpleBrowsingContext(options, security));
            }

            return(service.Create(options, security));
        }
        /// <summary>
        /// ClearStrategies
        /// </summary>
        public void ClearStrategies()
        {
            if (Sandboxes == null)
            {
                return;
            }

            foreach (var sandbox in Sandboxes)
            {
                sandbox.Strategy.ClearStrategyData();
            }

            Sandboxes.Clear();
        }
        /// <summary>
        /// AddPosition a strategy to the strategy executor
        /// </summary>
        /// <param name="strategy">the strategy to add</param>
        public bool AddStrategy(StrategyBase strategy)
        {
            if (Sandboxes == null)
            {
                Sandboxes = new List <StrategyExecutionSandbox>();
            }

            // sanity check to make sure another strategy with the same name is not already there.
            if (Sandboxes.FirstOrDefault(s => s.Strategy.Name == strategy.Name) != null)
            {
                return(false);
            }

            Sandboxes.Add(new StrategyExecutionSandbox(this, strategy));

            return(true);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Creates a new browsing context with the given name and creator.
        /// </summary>
        /// <param name="document">The creator of the context.</param>
        /// <param name="name">The name of the new context.</param>
        /// <param name="security">The sandbox flag of the context.</param>
        /// <returns>The new context.</returns>
        public static IBrowsingContext NewContext(this Document document, String name, Sandboxes security)
        {
            var options = document.Options;
            var service = options.GetService<IContextService>();

            if (service == null)
                return new BrowsingContext(document.Context, security);

            return service.Create(document.Context, name, security);
        }
Exemplo n.º 17
0
 /// <summary>
 /// Creates a new named browsing context as child of the given parent.
 /// </summary>
 /// <param name="parent">The parent context.</param>
 /// <param name="name">The name of the child context.</param>
 /// <param name="security">The security flags to apply.</param>
 /// <returns></returns>
 public IBrowsingContext Create(IBrowsingContext parent, String name, Sandboxes security)
 {
     var context = new BrowsingContext(parent, security);
     _cache[name] = new WeakReference<IBrowsingContext>(context);
     return context;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Creates a new document node.
 /// </summary>
 /// <param name="context">The context of the document.</param>
 /// <param name="source">The underlying source.</param>
 internal Document(IBrowsingContext context, TextSource source)
     : base(null, "#document", NodeType.Document)
 {
     _async = true;
     _designMode = false;
     _firedUnload = false;
     _salvageable = true;
     _shown = false;
     _preferredStyleSheetSet = String.Empty;
     _context = context ?? BrowsingContext.New();
     _source = source;
     _referrer = String.Empty;
     _contentType = MimeTypes.ApplicationXml;
     _ready = DocumentReadyState.Loading;
     _sandbox = Sandboxes.None;
     _quirksMode = QuirksMode.Off;
     _tasks = new CancellableTasks();
     _mutations = new MutationHost(Options);
     _loadingScripts = new Queue<HtmlScriptElement>();
     _location = new Location(AboutBlank);
     _ranges = new List<WeakReference<Range>>();
     _location.Changed += LocationChanged;
     _styleSheets = this.CreateStyleSheets();
     _view = this.CreateWindow();
     _loader = this.CreateLoader();
 }
Exemplo n.º 19
0
 public SimpleBrowsingContext(IConfiguration configuration, Sandboxes security)
 {
     _configuration = configuration;
     _security      = security;
 }
Exemplo n.º 20
0
 internal BrowsingContext(IBrowsingContext parent, Sandboxes security)
     : this(parent.OriginalServices, security)
 {
     _parent  = parent;
     _creator = _parent.Active;
 }
Exemplo n.º 21
0
 internal BrowsingContext(IBrowsingContext parent, Sandboxes security)
     : this(parent.Configuration, security)
 {
     _parent = parent;
     _creator = _parent.Active;
 }
Exemplo n.º 22
0
        public static IBrowsingContext NewContext(this IConfiguration configuration, Sandboxes security = Sandboxes.None)
        {
            var factory = configuration.GetFactory <IContextFactory>();

            return(factory.Create(configuration, security));
        }
Exemplo n.º 23
0
 /// <summary>
 /// Creates a new nested browsing context with the given name and
 /// creator.
 /// </summary>
 /// <param name="document">The creator of the context.</param>
 /// <param name="security">The sandbox flag of the context.</param>
 /// <returns>The new nesteted context.</returns>
 public static IBrowsingContext NewChildContext(this Document document, Sandboxes security)
 {
     //TODO
     return(document.NewContext(String.Empty, security));
 }
Exemplo n.º 24
0
 /// <summary>
 /// Creates a new browsing context from the given configuration.
 /// </summary>
 /// <param name="configuration">The configuration to use.</param>
 /// <param name="security">The security flags to apply.</param>
 /// <returns></returns>
 public IBrowsingContext Create(IConfiguration configuration, Sandboxes security)
 {
     return new BrowsingContext(configuration, security);
 }
Exemplo n.º 25
0
        /// <summary>
        /// Creates a new browsing context with the given name and creator.
        /// </summary>
        /// <param name="document">The creator of the context.</param>
        /// <param name="name">The name of the new context.</param>
        /// <param name="security">The sandbox flag of the context.</param>
        /// <returns>The new context.</returns>
        public static IBrowsingContext NewContext(this Document document, String name, Sandboxes security)
        {
            var options = document.Options;
            var service = options.GetService <IContextService>();

            if (service == null)
            {
                return(new SimpleBrowsingContext(options, security));
            }

            return(service.Create(options, name, document, security));
        }
Exemplo n.º 26
0
        /// <summary>
        /// Creates a new browsing context with the given name and creator.
        /// </summary>
        /// <param name="document">The creator of the context.</param>
        /// <param name="name">The name of the new context.</param>
        /// <param name="security">The sandbox flag of the context.</param>
        /// <returns>The new context.</returns>
        public static IBrowsingContext NewContext(this Document document, String name, Sandboxes security)
        {
            var options = document.Options;
            var factory = options.GetFactory <IContextFactory>();

            return(factory.Create(document.Context, name, security));
        }
Exemplo n.º 27
0
        /// <summary>
        /// Creates a new browsing context with the given name and creator.
        /// </summary>
        /// <param name="document">The creator of the context.</param>
        /// <param name="name">The name of the new context.</param>
        /// <param name="security">The sandbox flag of the context.</param>
        /// <returns>The new context.</returns>
        public static IBrowsingContext NewContext(this Document document, String name, Sandboxes security)
        {
            var options = document.Options;
            var service = options.GetService <IContextService>();

            return(service != null?service.Create(document.Context, name, security) : new BrowsingContext(document.Context, security));
        }
Exemplo n.º 28
0
 internal BrowsingContext(IBrowsingContext parent, Sandboxes security)
     : this(parent.Configuration, security)
 {
     _parent  = parent;
     _creator = _parent.Active;
 }
Exemplo n.º 29
0
        /// <summary>
        /// Creates a new named browsing context as child of the given parent.
        /// </summary>
        /// <param name="name">The name of the child context, if any.</param>
        /// <param name="security">The security flags to apply.</param>
        /// <returns></returns>
        public IBrowsingContext CreateChild(String?name, Sandboxes security)
        {
            var context = new BrowsingContext(this, security);

            if (name is { Length : > 0 })
Exemplo n.º 30
0
 /// <summary>
 /// Creates a new nested browsing context with the given name and 
 /// creator.
 /// </summary>
 /// <param name="document">The creator of the context.</param>
 /// <param name="security">The sandbox flag of the context.</param>
 /// <returns>The new nesteted context.</returns>
 public static IBrowsingContext NewChildContext(this Document document, Sandboxes security)
 {
     //TODO
     return document.NewContext(String.Empty, security);
 }
Exemplo n.º 31
0
 /// <summary>
 /// Creates a new browsing context from the given configuration.
 /// </summary>
 /// <param name="configuration">The configuration to use.</param>
 /// <param name="security">The security flags to apply.</param>
 /// <returns></returns>
 public IBrowsingContext Create(IConfiguration configuration, Sandboxes security)
 {
     return(new BrowsingContext(configuration, security));
 }