| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
GI.WebKit2.Objects.WebContext
Contents
- Exported types
- Methods
- addPathToSandbox
- allowTlsCertificateForHost
- clearCache
- downloadUri
- getCacheModel
- getCookieManager
- getDefault
- getFaviconDatabase
- getFaviconDatabaseDirectory
- getGeolocationManager
- getPlugins
- getPluginsFinish
- getProcessModel
- getSandboxEnabled
- getSecurityManager
- getSpellCheckingEnabled
- getSpellCheckingLanguages
- getTimeZoneOverride
- getTlsErrorsPolicy
- getUseSystemAppearanceForScrollbars
- getWebProcessCountLimit
- getWebsiteDataManager
- initializeNotificationPermissions
- isAutomationAllowed
- isEphemeral
- new
- newEphemeral
- newWithWebsiteDataManager
- prefetchDns
- registerUriScheme
- sendMessageToAllExtensions
- setAdditionalPluginsDirectory
- setAutomationAllowed
- setCacheModel
- setDiskCacheDirectory
- setFaviconDatabaseDirectory
- setNetworkProxySettings
- setPreferredLanguages
- setProcessModel
- setSandboxEnabled
- setSpellCheckingEnabled
- setSpellCheckingLanguages
- setTlsErrorsPolicy
- setUseSystemAppearanceForScrollbars
- setWebExtensionsDirectory
- setWebExtensionsInitializationUserData
- setWebProcessCountLimit
- Properties
- Signals
Description
Manages aspects common to all WebViews
The WebContext manages all aspects common to all
WebViews.
You can define the CacheModel and ProcessModel with
webContextSetCacheModel and
webContextSetProcessModel, depending on the needs of
your application. You can access the SecurityManager to specify
the behaviour of your application regarding security using
webContextGetSecurityManager.
It is also possible to change your preferred language or enable
spell checking, using webContextSetPreferredLanguages,
webContextSetSpellCheckingLanguages and
webContextSetSpellCheckingEnabled.
You can use webContextRegisterUriScheme 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 WebView::loadFailedWithTlsErrors.
Alternatively, you can use webContextSetTlsErrorsPolicy
to set the policy TLSErrorsPolicyIgnore; however, this is
not appropriate for Internet applications.
Synopsis
- newtype WebContext = WebContext (ManagedPtr WebContext)
- class (GObject o, IsDescendantOf WebContext o) => IsWebContext o
- toWebContext :: (MonadIO m, IsWebContext o) => o -> m WebContext
- webContextAddPathToSandbox :: (HasCallStack, MonadIO m, IsWebContext a) => a -> [Char] -> Bool -> m ()
- webContextAllowTlsCertificateForHost :: (HasCallStack, MonadIO m, IsWebContext a, IsTlsCertificate b) => a -> b -> Text -> m ()
- webContextClearCache :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m ()
- webContextDownloadUri :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Text -> m Download
- webContextGetCacheModel :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m CacheModel
- webContextGetCookieManager :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m CookieManager
- webContextGetDefault :: (HasCallStack, MonadIO m) => m WebContext
- webContextGetFaviconDatabase :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m FaviconDatabase
- webContextGetFaviconDatabaseDirectory :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m (Maybe Text)
- webContextGetGeolocationManager :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m GeolocationManager
- webContextGetPlugins :: (HasCallStack, MonadIO m, IsWebContext a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- webContextGetPluginsFinish :: (HasCallStack, MonadIO m, IsWebContext a, IsAsyncResult b) => a -> b -> m [Plugin]
- webContextGetProcessModel :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m ProcessModel
- webContextGetSandboxEnabled :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m Bool
- webContextGetSecurityManager :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m SecurityManager
- webContextGetSpellCheckingEnabled :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m Bool
- webContextGetSpellCheckingLanguages :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m (Maybe [Text])
- webContextGetTimeZoneOverride :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m Text
- webContextGetTlsErrorsPolicy :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m TLSErrorsPolicy
- webContextGetUseSystemAppearanceForScrollbars :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m Bool
- webContextGetWebProcessCountLimit :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m Word32
- webContextGetWebsiteDataManager :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m WebsiteDataManager
- webContextInitializeNotificationPermissions :: (HasCallStack, MonadIO m, IsWebContext a) => a -> [SecurityOrigin] -> [SecurityOrigin] -> m ()
- webContextIsAutomationAllowed :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m Bool
- webContextIsEphemeral :: (HasCallStack, MonadIO m, IsWebContext a) => a -> m Bool
- webContextNew :: (HasCallStack, MonadIO m) => m WebContext
- webContextNewEphemeral :: (HasCallStack, MonadIO m) => m WebContext
- webContextNewWithWebsiteDataManager :: (HasCallStack, MonadIO m, IsWebsiteDataManager a) => a -> m WebContext
- webContextPrefetchDns :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Text -> m ()
- webContextRegisterUriScheme :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Text -> URISchemeRequestCallback -> m ()
- webContextSendMessageToAllExtensions :: (HasCallStack, MonadIO m, IsWebContext a, IsUserMessage b) => a -> b -> m ()
- webContextSetAdditionalPluginsDirectory :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Text -> m ()
- webContextSetAutomationAllowed :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Bool -> m ()
- webContextSetCacheModel :: (HasCallStack, MonadIO m, IsWebContext a) => a -> CacheModel -> m ()
- webContextSetDiskCacheDirectory :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Text -> m ()
- webContextSetFaviconDatabaseDirectory :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Maybe Text -> m ()
- webContextSetNetworkProxySettings :: (HasCallStack, MonadIO m, IsWebContext a) => a -> NetworkProxyMode -> Maybe NetworkProxySettings -> m ()
- webContextSetPreferredLanguages :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Maybe [Text] -> m ()
- webContextSetProcessModel :: (HasCallStack, MonadIO m, IsWebContext a) => a -> ProcessModel -> m ()
- webContextSetSandboxEnabled :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Bool -> m ()
- webContextSetSpellCheckingEnabled :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Bool -> m ()
- webContextSetSpellCheckingLanguages :: (HasCallStack, MonadIO m, IsWebContext a) => a -> [Text] -> m ()
- webContextSetTlsErrorsPolicy :: (HasCallStack, MonadIO m, IsWebContext a) => a -> TLSErrorsPolicy -> m ()
- webContextSetUseSystemAppearanceForScrollbars :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Bool -> m ()
- webContextSetWebExtensionsDirectory :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Text -> m ()
- webContextSetWebExtensionsInitializationUserData :: (HasCallStack, MonadIO m, IsWebContext a) => a -> GVariant -> m ()
- webContextSetWebProcessCountLimit :: (HasCallStack, MonadIO m, IsWebContext a) => a -> Word32 -> m ()
- constructWebContextLocalStorageDirectory :: (IsWebContext o, MonadIO m) => Text -> m (GValueConstruct o)
- getWebContextLocalStorageDirectory :: (MonadIO m, IsWebContext o) => o -> m (Maybe Text)
- constructWebContextMemoryPressureSettings :: (IsWebContext o, MonadIO m) => MemoryPressureSettings -> m (GValueConstruct o)
- constructWebContextProcessSwapOnCrossSiteNavigationEnabled :: (IsWebContext o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWebContextProcessSwapOnCrossSiteNavigationEnabled :: (MonadIO m, IsWebContext o) => o -> m Bool
- constructWebContextTimeZoneOverride :: (IsWebContext o, MonadIO m) => Text -> m (GValueConstruct o)
- getWebContextTimeZoneOverride :: (MonadIO m, IsWebContext o) => o -> m Text
- constructWebContextUseSystemAppearanceForScrollbars :: (IsWebContext o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWebContextUseSystemAppearanceForScrollbars :: (MonadIO m, IsWebContext o) => o -> m Bool
- setWebContextUseSystemAppearanceForScrollbars :: (MonadIO m, IsWebContext o) => o -> Bool -> m ()
- constructWebContextWebsiteDataManager :: (IsWebContext o, MonadIO m, IsWebsiteDataManager a) => a -> m (GValueConstruct o)
- getWebContextWebsiteDataManager :: (MonadIO m, IsWebContext o) => o -> m WebsiteDataManager
- type WebContextAutomationStartedCallback = AutomationSession -> IO ()
- afterWebContextAutomationStarted :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextAutomationStartedCallback) -> m SignalHandlerId
- onWebContextAutomationStarted :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextAutomationStartedCallback) -> m SignalHandlerId
- type WebContextDownloadStartedCallback = Download -> IO ()
- afterWebContextDownloadStarted :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextDownloadStartedCallback) -> m SignalHandlerId
- onWebContextDownloadStarted :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextDownloadStartedCallback) -> m SignalHandlerId
- type WebContextInitializeNotificationPermissionsCallback = IO ()
- afterWebContextInitializeNotificationPermissions :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextInitializeNotificationPermissionsCallback) -> m SignalHandlerId
- onWebContextInitializeNotificationPermissions :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextInitializeNotificationPermissionsCallback) -> m SignalHandlerId
- type WebContextInitializeWebExtensionsCallback = IO ()
- afterWebContextInitializeWebExtensions :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextInitializeWebExtensionsCallback) -> m SignalHandlerId
- onWebContextInitializeWebExtensions :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextInitializeWebExtensionsCallback) -> m SignalHandlerId
- type WebContextUserMessageReceivedCallback = UserMessage -> IO Bool
- afterWebContextUserMessageReceived :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextUserMessageReceivedCallback) -> m SignalHandlerId
- onWebContextUserMessageReceived :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextUserMessageReceivedCallback) -> m SignalHandlerId
Exported types
newtype WebContext Source #
Memory-managed wrapper type.
Constructors
| WebContext (ManagedPtr WebContext) |
Instances
| Eq WebContext Source # | |
Defined in GI.WebKit2.Objects.WebContext | |
| GObject WebContext Source # | |
Defined in GI.WebKit2.Objects.WebContext | |
| ManagedPtrNewtype WebContext Source # | |
Defined in GI.WebKit2.Objects.WebContext Methods toManagedPtr :: WebContext -> ManagedPtr WebContext | |
| TypedObject WebContext Source # | |
Defined in GI.WebKit2.Objects.WebContext | |
| HasParentTypes WebContext Source # | |
Defined in GI.WebKit2.Objects.WebContext | |
| IsGValue (Maybe WebContext) Source # | Convert |
Defined in GI.WebKit2.Objects.WebContext Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe WebContext -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe WebContext) | |
| type ParentTypes WebContext Source # | |
Defined in GI.WebKit2.Objects.WebContext type ParentTypes WebContext = '[Object] | |
class (GObject o, IsDescendantOf WebContext o) => IsWebContext o Source #
Type class for types which can be safely cast to WebContext, for instance with toWebContext.
Instances
| (GObject o, IsDescendantOf WebContext o) => IsWebContext o Source # | |
Defined in GI.WebKit2.Objects.WebContext | |
toWebContext :: (MonadIO m, IsWebContext o) => o -> m WebContext Source #
Cast to WebContext, for types for which this is known to be safe. For general casts, use castTo.
Methods
Click to display all available methods, including inherited ones
Methods
addPathToSandbox, allowTlsCertificateForHost, bindProperty, bindPropertyFull, clearCache, downloadUri, forceFloating, freezeNotify, getv, initializeNotificationPermissions, isAutomationAllowed, isEphemeral, isFloating, notify, notifyByPspec, prefetchDns, ref, refSink, registerUriScheme, runDispose, sendMessageToAllExtensions, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getCacheModel, getCookieManager, getData, getFaviconDatabase, getFaviconDatabaseDirectory, getGeolocationManager, getPlugins, getPluginsFinish, getProcessModel, getProperty, getQdata, getSandboxEnabled, getSecurityManager, getSpellCheckingEnabled, getSpellCheckingLanguages, getTimeZoneOverride, getTlsErrorsPolicy, getUseSystemAppearanceForScrollbars, getWebProcessCountLimit, getWebsiteDataManager.
Setters
setAdditionalPluginsDirectory, setAutomationAllowed, setCacheModel, setData, setDataFull, setDiskCacheDirectory, setFaviconDatabaseDirectory, setNetworkProxySettings, setPreferredLanguages, setProcessModel, setProperty, setSandboxEnabled, setSpellCheckingEnabled, setSpellCheckingLanguages, setTlsErrorsPolicy, setUseSystemAppearanceForScrollbars, setWebExtensionsDirectory, setWebExtensionsInitializationUserData, setWebProcessCountLimit.
addPathToSandbox
webContextAddPathToSandbox Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> [Char] |
|
| -> Bool |
|
| -> m () |
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.
Paths in directories such as /sys, /proc, and /dev or all of /
are not valid.
See also webContextSetSandboxEnabled
Since: 2.26
allowTlsCertificateForHost
webContextAllowTlsCertificateForHost Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a, IsTlsCertificate b) | |
| => a |
|
| -> b |
|
| -> Text |
|
| -> m () |
Ignore further TLS errors on the host for the certificate present in info.
Since: 2.6
clearCache
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m () |
Clears all resources currently cached.
See also webContextSetCacheModel.
downloadUri
webContextDownloadUri Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Text |
|
| -> m Download | Returns: a new |
Requests downloading of the specified URI string.
The download operation will not be associated to any WebView,
if you are interested in starting a download from a particular WebView use
webViewDownloadUri instead.
getCacheModel
webContextGetCacheModel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m CacheModel | Returns: the current |
Returns the current cache model.
For more information about this
value check the documentation of the function
webContextSetCacheModel.
getCookieManager
webContextGetCookieManager Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m CookieManager | Returns: the |
Get the CookieManager of the context's WebsiteDataManager.
getDefault
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m WebContext | Returns: a |
Gets the default web context.
getFaviconDatabase
webContextGetFaviconDatabase Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m FaviconDatabase | Returns: the |
Get the FaviconDatabase associated with context.
To initialize the database you need to call
webContextSetFaviconDatabaseDirectory.
getFaviconDatabaseDirectory
webContextGetFaviconDatabaseDirectory Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m (Maybe Text) | Returns: the path of the directory of the favicons
database associated with |
Get the directory path to store the favicons database.
Get the directory path being used to store the favicons database
for context, or Nothing if
webContextSetFaviconDatabaseDirectory hasn't been
called yet.
This function will always return the same path after having called
webContextSetFaviconDatabaseDirectory for the first
time.
getGeolocationManager
webContextGetGeolocationManager Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m GeolocationManager | Returns: the |
Get the GeolocationManager of context.
Since: 2.26
getPlugins
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a, IsCancellable b) | |
| => a |
|
| -> Maybe b |
|
| -> Maybe AsyncReadyCallback |
|
| -> m () |
Deprecated: (Since version 2.32)
Asynchronously get the list of installed plugins.
When the operation is finished, callback will be called. You can then call
webContextGetPluginsFinish to get the result of the operation.
getPluginsFinish
webContextGetPluginsFinish Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a, IsAsyncResult b) | |
| => a |
|
| -> b |
|
| -> m [Plugin] | Returns: a |
Deprecated: (Since version 2.32)
Finish an asynchronous operation started with webkit_web_context_get_plugins.
getProcessModel
webContextGetProcessModel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m ProcessModel | Returns: the current |
Returns the current process model.
For more information about this value
see webContextSetProcessModel.
Since: 2.4
getSandboxEnabled
webContextGetSandboxEnabled Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m Bool |
Get whether sandboxing is currently enabled.
Since: 2.26
getSecurityManager
webContextGetSecurityManager Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m SecurityManager | Returns: the |
Get the SecurityManager of context.
getSpellCheckingEnabled
webContextGetSpellCheckingEnabled Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m Bool | Returns: |
Get whether spell checking feature is currently enabled.
getSpellCheckingLanguages
webContextGetSpellCheckingLanguages Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m (Maybe [Text]) | Returns: A |
Get the the list of spell checking languages.
Get the the list of spell checking languages associated with
context, or Nothing if no languages have been previously set.
See webContextSetSpellCheckingLanguages for more
details on the format of the languages in the list.
getTimeZoneOverride
webContextGetTimeZoneOverride Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m Text |
Get the WebContext:timeZoneOverride property.
Since: 2.38
getTlsErrorsPolicy
webContextGetTlsErrorsPolicy Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m TLSErrorsPolicy | Returns: a |
Deprecated: (Since version 2.32.)Use websiteDataManagerGetTlsErrorsPolicy instead.
Get the TLS errors policy of context.
getUseSystemAppearanceForScrollbars
webContextGetUseSystemAppearanceForScrollbars Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m Bool | Returns: |
Get the WebContext:useSystemAppearanceForScrollbars property.
Since: 2.30
getWebProcessCountLimit
webContextGetWebProcessCountLimit Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m Word32 | Returns: the maximum limit of web processes, or 0 if there isn't a limit. |
Deprecated: (Since version 2.26)
Gets the maximum number of web processes that can be created at the same time for the context.
This function is now deprecated and always returns 0 (no limit). See also webContextSetWebProcessCountLimit.
Since: 2.10
getWebsiteDataManager
webContextGetWebsiteDataManager Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m WebsiteDataManager | Returns: a |
Get the WebsiteDataManager of context.
Since: 2.10
initializeNotificationPermissions
webContextInitializeNotificationPermissions Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> [SecurityOrigin] |
|
| -> [SecurityOrigin] |
|
| -> m () |
Sets initial desktop notification permissions for the context.
allowedOrigins and disallowedOrigins must each be List of
SecurityOrigin objects representing origins that will,
respectively, either always or never have permission to show desktop
notifications. No NotificationPermissionRequest will ever be
generated for any of the security origins represented in
allowedOrigins or disallowedOrigins. This function is necessary
because some webpages proactively check whether they have permission
to display notifications without ever creating a permission request.
This function only affects web processes that have not already been created. The best time to call it is when handling WebContext::initializeNotificationPermissions so as to ensure that new web processes receive the most recent set of permissions.
Since: 2.16
isAutomationAllowed
webContextIsAutomationAllowed Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m Bool |
isEphemeral
webContextIsEphemeral Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> m Bool |
Get whether a WebContext is ephemeral.
Since: 2.16
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m WebContext | Returns: a newly created |
Create a new WebContext.
Since: 2.8
newEphemeral
webContextNewEphemeral Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m WebContext | Returns: a new ephemeral |
Create a new ephemeral WebContext.
An ephemeral WebContext is a context
created with an ephemeral WebsiteDataManager. This is just a convenient method
to create ephemeral contexts without having to create your own WebsiteDataManager.
All WebViews 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.
Since: 2.16
newWithWebsiteDataManager
webContextNewWithWebsiteDataManager Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebsiteDataManager a) | |
| => a |
|
| -> m WebContext | Returns: a newly created |
Create a new WebContext with a WebsiteDataManager.
Since: 2.10
prefetchDns
webContextPrefetchDns Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Text |
|
| -> m () |
Resolve the domain name of the given hostname in advance.
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.
registerUriScheme
webContextRegisterUriScheme Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Text |
|
| -> URISchemeRequestCallback |
|
| -> m () |
Register scheme in context.
Register scheme in context, so that when an URI request with scheme is made in the
WebContext, the URISchemeRequestCallback registered will be called with a
URISchemeRequest.
It is possible to handle URI scheme requests asynchronously, by calling objectRef on the
URISchemeRequest and calling uRISchemeRequestFinish later
when the data of the request is available or
uRISchemeRequestFinishError in case of error.
c code
static void
about_uri_scheme_request_cb (WebKitURISchemeRequest *request,
gpointer user_data)
{
GInputStream *stream;
gsize stream_length;
const gchar *path = webkit_uri_scheme_request_get_path (request);
if (!g_strcmp0 (path, "memory")) {
// Create a GInputStream with the contents of memory about page, and set its length to stream_length
} else if (!g_strcmp0 (path, "applications")) {
// Create a GInputStream with the contents of applications about page, and set its length to stream_length
} else if (!g_strcmp0 (path, "example")) {
gchar *contents = g_strdup_printf ("<html><body><p>Example about page</p></body></html>");
stream_length = strlen (contents);
stream = g_memory_input_stream_new_from_data (contents, stream_length, g_free);
} else {
GError *error = g_error_new (ABOUT_HANDLER_ERROR, ABOUT_HANDLER_ERROR_INVALID, "Invalid about:%s page.", path);
webkit_uri_scheme_request_finish_error (request, error);
g_error_free (error);
return;
}
webkit_uri_scheme_request_finish (request, stream, stream_length, "text/html");
g_object_unref (stream);
}sendMessageToAllExtensions
webContextSendMessageToAllExtensions Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a, IsUserMessage b) | |
| => a |
|
| -> b |
|
| -> m () |
Send message to all WebKitWebExtensions associated to context.
If message is floating, it's consumed.
Since: 2.28
setAdditionalPluginsDirectory
webContextSetAdditionalPluginsDirectory Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Text |
|
| -> m () |
Deprecated: (Since version 2.32)
Set an additional directory where WebKit will look for plugins.
setAutomationAllowed
webContextSetAutomationAllowed Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Bool |
|
| -> m () |
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 WebContext::automationStarted is emitted.
Automation is disabled by default, so you need to explicitly call this method passing True
to enable it.
Note that only one WebContext can have automation enabled, so this will do nothing
if there's another WebContext with automation already enabled.
Since: 2.18
setCacheModel
webContextSetCacheModel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> CacheModel |
|
| -> m () |
Specifies a usage model for WebViews.
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 .
Research indicates that users tend to browse within clusters of documents that hold resources in common, and to revisit previously visited documents. WebKit and the frameworks below it include built-in caches that take advantage of these patterns, substantially improving document load speed in browsing situations. The WebKit cache model controls the behaviors of all of these caches, including various WebCore caches.
Browsers can improve document load speed substantially by
specifying CacheModelWebBrowser. Applications without a
browsing interface can reduce memory usage substantially by
specifying CacheModelDocumentViewer. The default value is
CacheModelWebBrowser.
setDiskCacheDirectory
webContextSetDiskCacheDirectory Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Text |
|
| -> m () |
Deprecated: (Since version 2.10.)Use webContextNewWithWebsiteDataManager instead.
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.
Note that this method overrides the directory set in the WebsiteDataManager,
but it doesn't change the value returned by websiteDataManagerGetDiskCacheDirectory
since the WebsiteDataManager is immutable.
setFaviconDatabaseDirectory
webContextSetFaviconDatabaseDirectory Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Maybe Text |
|
| -> m () |
Set the directory path to store the favicons database.
Set the directory path to be used to store the favicons database
for context on disk. Passing Nothing as path means using the
default directory for the platform (see getUserCacheDir).
Calling this method also means enabling the favicons database for
its use from the applications, so that's why it's expected to be
called only once. Further calls for the same instance of
WebContext won't cause any effect.
setNetworkProxySettings
webContextSetNetworkProxySettings Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> NetworkProxyMode |
|
| -> Maybe NetworkProxySettings |
|
| -> m () |
Deprecated: (Since version 2.32.)Use websiteDataManagerSetNetworkProxySettings instead.
Set the network proxy settings to be used by connections started in context.
By default NetworkProxyModeDefault is used, which means that the
system settings will be used (proxyResolverGetDefault).
If you want to override the system default settings, you can either use
NetworkProxyModeNoProxy to make sure no proxies are used at all,
or NetworkProxyModeCustom to provide your own proxy settings.
When proxyMode is NetworkProxyModeCustom proxySettings must be
a valid NetworkProxySettings; otherwise, proxySettings must be Nothing.
Since: 2.16
setPreferredLanguages
webContextSetPreferredLanguages Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Maybe [Text] |
|
| -> m () |
Set the list of preferred languages.
Set the list of preferred languages, sorted from most desirable to least desirable. The list will be used in the following ways:
- Determining how to build the
Accept-LanguageHTTP header that will be included in the network requests started by theWebContext. - Setting the values of
navigator.languageandnavigator.languages. - The first item in the list sets the default locale for JavaScript
Intlfunctions.
setProcessModel
webContextSetProcessModel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> ProcessModel |
|
| -> m () |
Specifies a process model for WebViews.
Specifies a process model for WebViews, which WebKit will use to determine how auxiliary processes are handled.
ProcessModelMultipleSecondaryProcesses will use
one process per view most of the time, while still allowing for web
views to share a process when needed (for example when different
views interact with each other). Using this model, when a process
hangs or crashes, only the WebViews using it stop working, while
the rest of the WebViews in the application will still function
normally.
ProcessModelSharedSecondaryProcess is deprecated since 2.26,
using it has no effect for security reasons.
This method **must be called before any web process has been created**, as early as possible in your application. Calling it later will make your application crash.
Since: 2.4
setSandboxEnabled
webContextSetSandboxEnabled Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Bool |
|
| -> m () |
Set whether WebKit subprocesses will be sandboxed.
Set whether WebKit subprocesses will be sandboxed, limiting access to the system. This method **must be called before any web process has been created**, as early as possible in your application. Calling it later is a fatal error.
This is only implemented on Linux and is a no-op otherwise.
Since: 2.26
setSpellCheckingEnabled
webContextSetSpellCheckingEnabled Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Bool |
|
| -> m () |
Enable or disable the spell checking feature.
setSpellCheckingLanguages
webContextSetSpellCheckingLanguages Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> [Text] |
|
| -> m () |
Set the list of spell checking languages to be used for spell checking.
The locale string typically is in the form lang_COUNTRY, where lang is an ISO-639 language code, and COUNTRY is an ISO-3166 country code. For instance, sv_FI for Swedish as written in Finland or pt_BR for Portuguese as written in Brazil.
You need to call this function with a valid list of languages at least once in order to properly enable the spell checking feature in WebKit.
setTlsErrorsPolicy
webContextSetTlsErrorsPolicy Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> TLSErrorsPolicy |
|
| -> m () |
Deprecated: (Since version 2.32.)Use websiteDataManagerSetTlsErrorsPolicy instead.
Set the TLS errors policy of context as policy.
setUseSystemAppearanceForScrollbars
webContextSetUseSystemAppearanceForScrollbars Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Bool |
|
| -> m () |
Set the WebContext:useSystemAppearanceForScrollbars property.
Since: 2.30
setWebExtensionsDirectory
webContextSetWebExtensionsDirectory Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Text |
|
| -> m () |
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 WebContext::initializeWebExtensions to call this method before anything is loaded.
setWebExtensionsInitializationUserData
webContextSetWebExtensionsInitializationUserData Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> GVariant |
|
| -> m () |
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
WebContext::initializeWebExtensions to call this method
before anything is loaded.
Since: 2.4
setWebProcessCountLimit
webContextSetWebProcessCountLimit Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebContext a) | |
| => a |
|
| -> Word32 |
|
| -> m () |
Deprecated: (Since version 2.26)
Sets the maximum number of web processes.
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.
This function is now deprecated and does nothing for security reasons.
Since: 2.10
Properties
localStorageDirectory
The directory where local storage data will be saved.
Since: 2.8
constructWebContextLocalStorageDirectory :: (IsWebContext o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “local-storage-directory” property. This is rarely needed directly, but it is used by new.
getWebContextLocalStorageDirectory :: (MonadIO m, IsWebContext o) => o -> m (Maybe Text) Source #
Get the value of the “local-storage-directory” property.
When overloading is enabled, this is equivalent to
get webContext #localStorageDirectory
memoryPressureSettings
The MemoryPressureSettings applied to the web processes created by this context.
Since: 2.34
constructWebContextMemoryPressureSettings :: (IsWebContext o, MonadIO m) => MemoryPressureSettings -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “memory-pressure-settings” property. This is rarely needed directly, but it is used by new.
processSwapOnCrossSiteNavigationEnabled
Whether swap Web processes on cross-site navigations is enabled.
When enabled, pages from each security origin will be handled by their own separate Web processes, which are started (and terminated) on demand as the user navigates across different domains. This is an important security measure which helps prevent websites stealing data from other visited pages.
Since: 2.28
constructWebContextProcessSwapOnCrossSiteNavigationEnabled :: (IsWebContext o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “process-swap-on-cross-site-navigation-enabled” property. This is rarely needed directly, but it is used by new.
getWebContextProcessSwapOnCrossSiteNavigationEnabled :: (MonadIO m, IsWebContext o) => o -> m Bool Source #
Get the value of the “process-swap-on-cross-site-navigation-enabled” property.
When overloading is enabled, this is equivalent to
get webContext #processSwapOnCrossSiteNavigationEnabled
timeZoneOverride
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.
The expected values for this property are defined in the IANA timezone database. See this wikipedia page for instance, https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
Since: 2.38
constructWebContextTimeZoneOverride :: (IsWebContext o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “time-zone-override” property. This is rarely needed directly, but it is used by new.
getWebContextTimeZoneOverride :: (MonadIO m, IsWebContext o) => o -> m Text Source #
Get the value of the “time-zone-override” property.
When overloading is enabled, this is equivalent to
get webContext #timeZoneOverride
useSystemAppearanceForScrollbars
Whether to use system appearance for rendering scrollbars.
This is enabled by default for backwards compatibility, but it's only recommened to use when the application includes other widgets to ensure consistency, or when consistency with other applications is required too.
Since: 2.30
constructWebContextUseSystemAppearanceForScrollbars :: (IsWebContext o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “use-system-appearance-for-scrollbars” property. This is rarely needed directly, but it is used by new.
getWebContextUseSystemAppearanceForScrollbars :: (MonadIO m, IsWebContext o) => o -> m Bool Source #
Get the value of the “use-system-appearance-for-scrollbars” property.
When overloading is enabled, this is equivalent to
get webContext #useSystemAppearanceForScrollbars
setWebContextUseSystemAppearanceForScrollbars :: (MonadIO m, IsWebContext o) => o -> Bool -> m () Source #
Set the value of the “use-system-appearance-for-scrollbars” property.
When overloading is enabled, this is equivalent to
setwebContext [ #useSystemAppearanceForScrollbars:=value ]
websiteDataManager
The WebsiteDataManager associated with this context.
Since: 2.10
constructWebContextWebsiteDataManager :: (IsWebContext o, MonadIO m, IsWebsiteDataManager a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “website-data-manager” property. This is rarely needed directly, but it is used by new.
getWebContextWebsiteDataManager :: (MonadIO m, IsWebContext o) => o -> m WebsiteDataManager Source #
Get the value of the “website-data-manager” property.
When overloading is enabled, this is equivalent to
get webContext #websiteDataManager
Signals
automationStarted
type WebContextAutomationStartedCallback Source #
Arguments
| = AutomationSession |
|
| -> IO () |
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 webContextSetAutomationAllowed for more details.
Since: 2.18
afterWebContextAutomationStarted :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextAutomationStartedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the automationStarted signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webContext #automationStarted callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebContextAutomationStarted :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextAutomationStartedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the automationStarted signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webContext #automationStarted callback
downloadStarted
type WebContextDownloadStartedCallback Source #
This signal is emitted when a new download request is made.
afterWebContextDownloadStarted :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextDownloadStartedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the downloadStarted signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webContext #downloadStarted callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebContextDownloadStarted :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextDownloadStartedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the downloadStarted signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webContext #downloadStarted callback
initializeNotificationPermissions
type WebContextInitializeNotificationPermissionsCallback = IO () Source #
This signal is emitted when a WebContext 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
webContextInitializeNotificationPermissions. If no
notification permissions have changed since the last time this
signal was emitted, then there is no need to call
webContextInitializeNotificationPermissions again.
Since: 2.16
afterWebContextInitializeNotificationPermissions :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextInitializeNotificationPermissionsCallback) -> m SignalHandlerId Source #
Connect a signal handler for the initializeNotificationPermissions signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webContext #initializeNotificationPermissions callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebContextInitializeNotificationPermissions :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextInitializeNotificationPermissionsCallback) -> m SignalHandlerId Source #
Connect a signal handler for the initializeNotificationPermissions signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webContext #initializeNotificationPermissions callback
initializeWebExtensions
type WebContextInitializeWebExtensionsCallback = IO () Source #
This signal is emitted when a new web process is about to be
launched. It signals the most appropriate moment to use
webContextSetWebExtensionsInitializationUserData
and webContextSetWebExtensionsDirectory.
Since: 2.4
afterWebContextInitializeWebExtensions :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextInitializeWebExtensionsCallback) -> m SignalHandlerId Source #
Connect a signal handler for the initializeWebExtensions signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webContext #initializeWebExtensions callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebContextInitializeWebExtensions :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextInitializeWebExtensionsCallback) -> m SignalHandlerId Source #
Connect a signal handler for the initializeWebExtensions signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webContext #initializeWebExtensions callback
userMessageReceived
type WebContextUserMessageReceivedCallback Source #
Arguments
| = UserMessage |
|
| -> IO Bool | Returns: |
This signal is emitted when a UserMessage is received from a
WebKitWebExtension. You can reply to the message using
userMessageSendReply.
You can handle the user message asynchronously by calling objectRef on
message and returning True.
Since: 2.28
afterWebContextUserMessageReceived :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextUserMessageReceivedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the userMessageReceived signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webContext #userMessageReceived callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebContextUserMessageReceived :: (IsWebContext a, MonadIO m) => a -> ((?self :: a) => WebContextUserMessageReceivedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the userMessageReceived signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webContext #userMessageReceived callback