WebContext
Object Hierarchy:
Description:
Manages aspects common to all WebView<!-- -->s
The WebContext manages all aspects common to all WebView <!-- -->s.
You can define the CacheModel with set_cache_model, depending on the needs of your application. You can access the SecurityManager to specify the behaviour of your application regarding security using get_security_manager .
It is also possible to change your preferred language or enable spell checking, using set_preferred_languages, set_spell_checking_languages and set_spell_checking_enabled.
You can use register_uri_scheme to register custom URI schemes, and manage several other settings.
TLS certificate validation failure is now treated as a transport error by default. To handle TLS failures differently, you can connect to load_failed_with_tls_errors. Alternatively, you can use set_tls_errors_policy to set the policy webkit_tls_errors_policy_ignore; however, this is not appropriate for Internet applications.
Content:
Properties:
- public string local_storage_directory { owned get; construct; }
The directory where local storage data will be saved.
- public MemoryPressureSettings memory_pressure_settings { construct; }
The MemoryPressureSettings applied to the web processes created by this context.
- public bool process_swap_on_cross_site_navigation_enabled { get; construct; }
Whether swap Web processes on cross-site navigations is enabled.
- public string time_zone_override { get; construct; }
The timezone override for this web context.
- public bool use_system_appearance_for_scrollbars { get; set construct; }
Whether to use system appearance for rendering scrollbars.
- public WebsiteDataManager website_data_manager { get; construct; }
The WebsiteDataManager associated with this context.
Static methods:
- public static unowned WebContext get_default ()
Gets the default web context.
Creation methods:
- public WebContext ()
Create a new WebContext.
- public WebContext.ephemeral ()
Create a new ephemeral WebContext.
- public WebContext.with_website_data_manager (WebsiteDataManager manager)
Create a new WebContext with a WebsiteDataManager.
Methods:
- public void add_path_to_sandbox (string path, bool read_only)
Adds a path to be mounted in the sandbox.
- public void allow_tls_certificate_for_host (TlsCertificate certificate, string host)
Ignore further TLS errors on the
hostfor the certificate present ininfo. - public void clear_cache ()
Clears all resources currently cached.
- public Download download_uri (string uri)
Requests downloading of the specified URI string.
- public CacheModel get_cache_model ()
Returns the current cache model.
- public unowned CookieManager get_cookie_manager ()
Get the CookieManager of the this's WebsiteDataManager.
- public unowned FaviconDatabase get_favicon_database ()
Get the FaviconDatabase associated with this.
- public unowned string get_favicon_database_directory ()
Get the directory path to store the favicons database.
- public unowned GeolocationManager get_geolocation_manager ()
Get the GeolocationManager of this.
- public async List<Plugin> get_plugins (Cancellable? cancellable = null) throws Error
Asynchronously get the list of installed plugins.
- public ProcessModel get_process_model ()
Returns webkit_process_model_multiple_secondary_processes.
- public bool get_sandbox_enabled ()
Get whether sandboxing is currently enabled.
- public unowned SecurityManager get_security_manager ()
Get the SecurityManager of this.
- public bool get_spell_checking_enabled ()
Get whether spell checking feature is currently enabled.
- public unowned string[] get_spell_checking_languages ()
Get the the list of spell checking languages.
- public unowned string get_time_zone_override ()
Get the time_zone_override property.
- public TLSErrorsPolicy get_tls_errors_policy ()
Get the TLS errors policy of this.
- public bool get_use_system_appearance_for_scrollbars ()
Get the use_system_appearance_for_scrollbars property.
- public uint get_web_process_count_limit ()
Gets the maximum number of web processes that can be created at the same time for the this.
- public unowned WebsiteDataManager get_website_data_manager ()
Get the WebsiteDataManager of this.
- public void init_notification_permissions (List<SecurityOrigin> allowed_origins, List<SecurityOrigin> disallowed_origins)
- public bool is_automation_allowed ()
Get whether automation is allowed in this.
- public bool is_ephemeral ()
Get whether a WebContext is ephemeral.
- public void prefetch_dns (string hostname)
Resolve the domain name of the given
hostnamein advance. - public void register_uri_scheme (string scheme, owned URISchemeRequestCallback callback)
Register
schemein this. - public void send_message_to_all_extensions (UserMessage message)
Send
messageto all web process extensions associated to this. - public void set_additional_plugins_directory (string directory)
Set an additional directory where WebKit will look for plugins.
- public void set_automation_allowed (bool allowed)
Set whether automation is allowed in this.
- public void set_cache_model (CacheModel cache_model)
Specifies a usage model for WebViews.
- public void set_disk_cache_directory (string directory)
Set the directory where disk cache files will be stored.
- public void set_favicon_database_directory (string? path)
Set the directory path to store the favicons database.
- public void set_network_proxy_settings (NetworkProxyMode proxy_mode, NetworkProxySettings? proxy_settings)
Set the network proxy settings to be used by connections started in this.
- public void set_preferred_languages (string[]? languages)
Set the list of preferred languages.
- public void set_process_model (ProcessModel process_model)
This function previously allowed specifying the process model to use.
- public void set_sandbox_enabled (bool enabled)
Set whether WebKit subprocesses will be sandboxed.
- public void set_spell_checking_enabled (bool enabled)
Enable or disable the spell checking feature.
- public void set_spell_checking_languages (string[] languages)
Set the list of spell checking languages to be used for spell checking.
- public void set_tls_errors_policy (TLSErrorsPolicy policy)
Set the TLS errors policy of this as
policy. - public void set_use_system_appearance_for_scrollbars (bool enabled)
Set the use_system_appearance_for_scrollbars property.
- public void set_web_extensions_directory (string directory)
Set the directory where WebKit will look for web process extensions.
- public void set_web_extensions_initialization_user_data (Variant user_data)
Set user data to be passed to web process extensions on initialization.
- public void set_web_process_count_limit (uint limit)
Sets the maximum number of web processes.
Signals:
- public virtual signal void automation_started (AutomationSession session)
This signal is emitted when a new automation request is made.
- public virtual signal void download_started (Download download)
This signal is emitted when a new download request is made.
- public virtual signal void initialize_notification_permissions ()
This signal is emitted when a WebContext needs to set initial notification permissions for a web process.
- public virtual signal void initialize_web_extensions ()
This signal is emitted when a new web process is about to be launched.
- public virtual signal bool user_message_received (UserMessage message)
This signal is emitted when a UserMessage is received from a web process extension.