WebKit2.UserScript¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
Details¶
- class WebKit2.UserScript¶
A JavaScript snippet which can be injected in loaded pages.
New in version 2.6.
- classmethod new(source, injected_frames, injection_time, allow_list, block_list)¶
- Parameters:
source (
str
) – Source code of the user script.injected_frames (
WebKit2.UserContentInjectedFrames
) – AWebKit2.UserContentInjectedFrames
valueinjection_time (
WebKit2.UserScriptInjectionTime
) – AWebKit2.UserScriptInjectionTime
valueallow_list ([
str
] orNone
) – An allow_list of URI patterns orNone
block_list ([
str
] orNone
) – A block_list of URI patterns orNone
- Returns:
A new
WebKit2.UserScript
- Return type:
Creates a new user script.
Scripts can be applied to some URIs only by passing non-null values for allow_list or block_list. Passing a
None
allow_list implies that all URIs are on the allow_list. The script is applied if an URI matches the allow_list and not the block_list. URI patterns must be of the form[protocol]://[host]/[path]
, where the *host* and *path* components can contain the wildcard character (*
) to represent zero or more other characters.New in version 2.6.
- classmethod new_for_world(source, injected_frames, injection_time, world_name, allow_list, block_list)¶
- Parameters:
source (
str
) – Source code of the user script.injected_frames (
WebKit2.UserContentInjectedFrames
) – AWebKit2.UserContentInjectedFrames
valueinjection_time (
WebKit2.UserScriptInjectionTime
) – AWebKit2.UserScriptInjectionTime
valueworld_name (
str
) – the name of a #WebKitScriptWorldallow_list ([
str
] orNone
) – An allow_list of URI patterns orNone
block_list ([
str
] orNone
) – A block_list of URI patterns orNone
- Returns:
A new
WebKit2.UserScript
- Return type:
Creates a new user script for script world with name world_name.
See
WebKit2.UserScript.new
() for a full description.New in version 2.22.
- ref()¶
- Returns:
The passed
WebKit2.UserScript
- Return type:
Atomically increments the reference count of self by one.
This function is MT-safe and may be called from any thread.
New in version 2.6.
- unref()¶
Atomically decrements the reference count of self by one.
If the reference count drops to 0, all memory allocated by
WebKit2.UserScript
is released. This function is MT-safe and may be called from any thread.New in version 2.6.