WebContext

class WebContext(pointer: <Error class: unknown class><<Error class: unknown class>>)

Manages aspects common to all #WebKitWebViews

The #WebKitWebContext manages all aspects common to all #WebKitWebViews.

You can define the #WebKitCacheModel with webkit_web_context_set_cache_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.

Skipped during bindings generation

  • method memory-pressure-settings: Property has no getter nor setter

Constructors

Link copied to clipboard
constructor()

Create a new #WebKitWebContext.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

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.

Link copied to clipboard
val webkitWebContextPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
fun addPathToSandbox(path: String, readOnly: Boolean)

Adds a path to be mounted in the sandbox.

Link copied to clipboard
fun connectAutomationStarted(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (session: AutomationSession) -> Unit): <Error class: unknown class>

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.

Link copied to clipboard
fun connectInitializeNotificationPermissions(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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.

Link copied to clipboard
fun connectInitializeWebProcessExtensions(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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_process_extensions_initialization_user_data() and webkit_web_context_set_web_process_extensions_directory().

Link copied to clipboard
fun connectUserMessageReceived(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (message: UserMessage) -> Boolean): <Error class: unknown class>

This signal is emitted when a #WebKitUserMessage is received from a web process extension. You can reply to the message using webkit_user_message_send_reply().

Link copied to clipboard

Returns the current cache model.

Link copied to clipboard

Get the #WebKitGeolocationManager of @context.

Link copied to clipboard

Get the #WebKitNetworkSession used for automation sessions started in @context.

Link copied to clipboard

Get the #WebKitSecurityManager of @context.

Link copied to clipboard

Get whether spell checking feature is currently enabled.

Link copied to clipboard

Get the the list of spell checking languages.

Link copied to clipboard
fun initializeNotificationPermissions(allowedOrigins: <Error class: unknown class>, disallowedOrigins: <Error class: unknown class>)

Sets initial desktop notification permissions for the @context.

Link copied to clipboard

Get whether automation is allowed in @context.

Link copied to clipboard

Register @scheme in @context.

Link copied to clipboard

Send @message to all web process extensions associated to @context.

Link copied to clipboard

Set whether automation is allowed in @context.

Link copied to clipboard
fun setCacheModel(cacheModel: CacheModel)

Specifies a usage model for WebViews.

Link copied to clipboard
fun setPreferredLanguages(languages: List<String>? = null)

Set the list of preferred languages.

Link copied to clipboard

Enable or disable the spell checking feature.

Link copied to clipboard

Set the list of spell checking languages to be used for spell checking.

Link copied to clipboard

Set the directory where WebKit will look for web process extensions.

fun setWebProcessExtensionsInitializationUserData(userData: <Error class: unknown class>)

Set user data to be passed to Web Extensions on initialization.