Class
WebKit2WebContext
Description [src]
class WebKit2.WebContext : GObject.Object {
parent: GObject
}
Manages aspects common to all WebKitWebView
s
The WebKitWebContext
manages all aspects common to all
WebKitWebView
s.
You can define the WebKitCacheModel
and WebKitProcessModel
with
webkit_web_context_set_cache_model()
and
webkit_web_context_set_process_model(), depending on the needs of
your application. You can access the WebKitSecurityManager
to specify
the behaviour of your application regarding security using webkit_web_context_get_security_manager().
It is also possible to change your preferred language or enable
spell checking, using webkit_web_context_set_preferred_languages(),
webkit_web_context_set_spell_checking_languages()
and webkit_web_context_set_spell_checking_enabled().
You can use webkit_web_context_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 WebKitWebView::load-failed-with-tls-errors
.
Alternatively, you can use webkit_web_context_set_tls_errors_policy()
to set the policy WEBKIT_TLS_ERRORS_POLICY_IGNORE
; however, this is
not appropriate for Internet applications.
Constructors
webkit_web_context_new_ephemeral
Create a new ephemeral WebKitWebContext
. An ephemeral WebKitWebContext
is a context
created with an ephemeral WebKitWebsiteDataManager
. This is just a convenient method
to create ephemeral contexts without having to create your own WebKitWebsiteDataManager
.
All WebKitWebView
s associated with this context will also be ephemeral. Websites will
not store any data in the client storage.
This is normally used to implement private instances.
Available since: 2.16
webkit_web_context_new_with_website_data_manager
Create a new WebKitWebContext
with a WebKitWebsiteDataManager
.
Available since: 2.10
Functions
webkit_web_context_get_default
Gets the default web context.
Instance methods
webkit_web_context_add_path_to_sandbox
Adds a path to be mounted in the sandbox. path
must exist before any web process
has been created otherwise it will be silently ignored. It is a fatal error to
add paths after a web process has been spawned.
Available since: 2.26
webkit_web_context_allow_tls_certificate_for_host
Ignore further TLS errors on the host
for the certificate present in info
.
Available since: 2.6
webkit_web_context_clear_cache
Clears all resources currently cached. See also webkit_web_context_set_cache_model().
webkit_web_context_download_uri
Requests downloading of the specified URI string. The download operation
will not be associated to any WebKitWebView
, if you are interested in
starting a download from a particular WebKitWebView
use
webkit_web_view_download_uri()
instead.
webkit_web_context_get_cache_model
Returns the current cache model. For more information about this value check the documentation of the function webkit_web_context_set_cache_model().
webkit_web_context_get_cookie_manager
Get the WebKitCookieManager
of the context
‘s WebKitWebsiteDataManager
.
webkit_web_context_get_favicon_database
Get the WebKitFaviconDatabase
associated with context
.
webkit_web_context_get_favicon_database_directory
Get the directory path being used to store the favicons database
for context
, or NULL
if
webkit_web_context_set_favicon_database_directory()
hasn’t been
called yet.
webkit_web_context_get_geolocation_manager
Get the WebKitGeolocationManager
of context
.
Available since: 2.26
webkit_web_context_get_plugins
Asynchronously get the list of installed plugins.
Deprecated since: 2.32
webkit_web_context_get_plugins_finish
Finish an asynchronous operation started with webkit_web_context_get_plugins.
Deprecated since: 2.32
webkit_web_context_get_process_model
Returns the current process model. For more information about this value see webkit_web_context_set_process_model().
Available since: 2.4
webkit_web_context_get_sandbox_enabled
Get whether sandboxing is currently enabled.
Available since: 2.26
webkit_web_context_get_security_manager
Get the WebKitSecurityManager
of context
.
webkit_web_context_get_spell_checking_enabled
Get whether spell checking feature is currently enabled.
webkit_web_context_get_spell_checking_languages
Get the the list of spell checking languages associated with
context
, or NULL
if no languages have been previously set.
webkit_web_context_get_time_zone_override
Get the WebKitWebContext:time-zone-override
property.
Available since: 2.38
webkit_web_context_get_tls_errors_policy
Get the TLS errors policy of context
.
Deprecated since: 2.32.
webkit_web_context_get_use_system_appearance_for_scrollbars
Get the WebKitWebContext:use-system-appearance-for-scrollbars
property.
Available since: 2.30
webkit_web_context_get_web_process_count_limit
Gets the maximum number of web processes that can be created at the same time for the context
.
Available since: 2.10
Deprecated since: 2.26
webkit_web_context_get_website_data_manager
Get the WebKitWebsiteDataManager
of context
.
Available since: 2.10
webkit_web_context_initialize_notification_permissions
Sets initial desktop notification permissions for the context
.
allowed_origins
and disallowed_origins
must each be GList
of
WebKitSecurityOrigin
objects representing origins that will,
respectively, either always or never have permission to show desktop
notifications. No WebKitNotificationPermissionRequest
will ever be
generated for any of the security origins represented in
allowed_origins
or disallowed_origins
. This function is necessary
because some webpages proactively check whether they have permission
to display notifications without ever creating a permission request.
Available since: 2.16
webkit_web_context_is_automation_allowed
Get whether automation is allowed in context
.
See also webkit_web_context_set_automation_allowed().
Available since: 2.18
webkit_web_context_prefetch_dns
Resolve the domain name of the given hostname
in advance, so that if a URI
of hostname
is requested the load will be performed more quickly.
webkit_web_context_register_uri_scheme
Register scheme
in context
, so that when an URI request with scheme
is made in the
WebKitWebContext
, the WebKitURISchemeRequestCallback
registered will be called with a
WebKitURISchemeRequest
.
It is possible to handle URI scheme requests asynchronously, by calling g_object_ref()
on the
WebKitURISchemeRequest
and calling webkit_uri_scheme_request_finish()
later
when the data of the request is available or
webkit_uri_scheme_request_finish_error()
in case of error.
webkit_web_context_send_message_to_all_extensions
Send message
to all WebKitWebExtension
s associated to context
.
If message
is floating, it’s consumed.
Available since: 2.28
webkit_web_context_set_additional_plugins_directory
Set an additional directory where WebKit will look for plugins.
Deprecated since: 2.32
webkit_web_context_set_automation_allowed
Set whether automation is allowed in context
. When automation is enabled the browser could
be controlled by another process by requesting an automation session. When a new automation
session is requested the signal WebKitWebContext::automation-started
is emitted.
Automation is disabled by default, so you need to explicitly call this method passing TRUE
to enable it.
Available since: 2.18
webkit_web_context_set_cache_model
Specifies a usage model for WebViews, which WebKit will use to determine its caching behavior. All web views follow the cache model. This cache model determines the RAM and disk space to use for caching previously viewed content .
webkit_web_context_set_disk_cache_directory
Set the directory where disk cache files will be stored This method must be called before loading anything in this context, otherwise it will not have any effect.
Deprecated since: 2.10.
webkit_web_context_set_favicon_database_directory
Set the directory path to be used to store the favicons database
for context
on disk. Passing NULL
as path
means using the
default directory for the platform (see g_get_user_cache_dir()).
webkit_web_context_set_network_proxy_settings
Set the network proxy settings to be used by connections started in context
.
By default WEBKIT_NETWORK_PROXY_MODE_DEFAULT
is used, which means that the
system settings will be used (g_proxy_resolver_get_default()).
If you want to override the system default settings, you can either use
WEBKIT_NETWORK_PROXY_MODE_NO_PROXY
to make sure no proxies are used at all,
or WEBKIT_NETWORK_PROXY_MODE_CUSTOM
to provide your own proxy settings.
When proxy_mode
is WEBKIT_NETWORK_PROXY_MODE_CUSTOM
proxy_settings
must be
a valid WebKitNetworkProxySettings
; otherwise, proxy_settings
must be NULL
.
Available since: 2.16
Deprecated since: 2.32.
webkit_web_context_set_preferred_languages
Set the list of preferred languages, sorted from most desirable to least desirable. The list will be used in the following ways:
webkit_web_context_set_process_model
Specifies a process model for WebViews, which WebKit will use to determine how auxiliary processes are handled.
Available since: 2.4
webkit_web_context_set_sandbox_enabled
Set whether WebKit subprocesses will be sandboxed, limiting access to the system.
Available since: 2.26
webkit_web_context_set_spell_checking_enabled
Enable or disable the spell checking feature.
webkit_web_context_set_spell_checking_languages
Set the list of spell checking languages to be used for spell checking.
webkit_web_context_set_tls_errors_policy
Set the TLS errors policy of context
as policy
.
Deprecated since: 2.32.
webkit_web_context_set_use_system_appearance_for_scrollbars
Set the WebKitWebContext:use-system-appearance-for-scrollbars
property.
Available since: 2.30
webkit_web_context_set_web_extensions_directory
Set the directory where WebKit will look for Web Extensions.
This method must be called before loading anything in this context,
otherwise it will not have any effect. You can connect to
WebKitWebContext::initialize-web-extensions
to call this method
before anything is loaded.
webkit_web_context_set_web_extensions_initialization_user_data
Set user data to be passed to Web Extensions on initialization.
The data will be passed to the
WebKitWebExtensionInitializeWithUserDataFunction
.
This method must be called before loading anything in this context,
otherwise it will not have any effect. You can connect to
WebKitWebContext::initialize-web-extensions
to call this method
before anything is loaded.
Available since: 2.4
webkit_web_context_set_web_process_count_limit
Sets the maximum number of web processes that can be created at the same time for the context
.
The default value is 0 and means no limit.
Available since: 2.10
Deprecated since: 2.26
Properties
WebKit2.WebContext:local-storage-directory
The directory where local storage data will be saved.
Available since: 2.8
Deprecated since: 2.10.
WebKit2.WebContext:memory-pressure-settings
The WebKitMemoryPressureSettings
applied to the web processes created by this context.
Available since: 2.34
WebKit2.WebContext:process-swap-on-cross-site-navigation-enabled
Whether swap Web processes on cross-site navigations is enabled.
Available since: 2.28
WebKit2.WebContext:time-zone-override
The timezone override for this web context. Setting this property provides a better alternative to configure the timezone information for all webviews managed by the WebContext. The other, less optimal, approach is to globally set the TZ environment variable in the process before creating the context. However this approach might not be very convenient and can have side-effects in your application.
Available since: 2.38
WebKit2.WebContext:use-system-appearance-for-scrollbars
Whether to use system appearance for rendering scrollbars.
Available since: 2.30
WebKit2.WebContext:website-data-manager
The WebKitWebsiteDataManager
associated with this context.
Available since: 2.10
Signals
WebKit2.WebContext::automation-started
This signal is emitted when a new automation request is made.
Note that it will never be emitted if automation is not enabled in context
,
see webkit_web_context_set_automation_allowed()
for more details.
Available since: 2.18
WebKit2.WebContext::download-started
This signal is emitted when a new download request is made.
WebKit2.WebContext::initialize-notification-permissions
This signal is emitted when a WebKitWebContext
needs to set
initial notification permissions for a web process. It is emitted
when a new web process is about to be launched, and signals the
most appropriate moment to use
webkit_web_context_initialize_notification_permissions(). If no
notification permissions have changed since the last time this
signal was emitted, then there is no need to call
webkit_web_context_initialize_notification_permissions()
again.
Available since: 2.16
WebKit2.WebContext::initialize-web-extensions
This signal is emitted when a new web process is about to be
launched. It signals the most appropriate moment to use
webkit_web_context_set_web_extensions_initialization_user_data()
and webkit_web_context_set_web_extensions_directory().
Available since: 2.4
WebKit2.WebContext::user-message-received
This signal is emitted when a WebKitUserMessage
is received from a
WebKitWebExtension
. You can reply to the message using webkit_user_message_send_reply().
Available since: 2.28
Signals inherited from GObject (1)
GObject.Object::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
Class structure
struct WebKit2WebContextClass {
GObjectClass parent;
void (* download_started) (
WebKitWebContext* context,
WebKitDownload* download
);
void (* initialize_web_extensions) (
WebKitWebContext* context
);
void (* initialize_notification_permissions) (
WebKitWebContext* context
);
void (* automation_started) (
WebKitWebContext* context,
WebKitAutomationSession* session
);
gboolean (* user_message_received) (
WebKitWebContext* context,
WebKitUserMessage* message
);
void (* _webkit_reserved0) (
void
);
void (* _webkit_reserved1) (
void
);
void (* _webkit_reserved2) (
void
);
}
Class members
parent |
|
No description available. | |
download_started |
|
No description available. | |
initialize_web_extensions |
|
No description available. | |
initialize_notification_permissions |
|
No description available. | |
automation_started |
|
No description available. | |
user_message_received |
|
No description available. | |
_webkit_reserved0 |
|
No description available. | |
_webkit_reserved1 |
|
No description available. | |
_webkit_reserved2 |
|
No description available. |