Package org.gnome.webkit
Class UserScript
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.webkit.UserScript
-
Constructor Summary
ConstructorDescriptionUserScript
(MemorySegment address) Create a UserScript proxy instance for the provided memory address.UserScript
(String source, UserContentInjectedFrames injectedFrames, UserScriptInjectionTime injectionTime, @Nullable String[] allowList, @Nullable String[] blockList) Creates a new user script. -
Method Summary
Modifier and TypeMethodDescriptionstatic UserScript
forWorld
(String source, UserContentInjectedFrames injectedFrames, UserScriptInjectionTime injectionTime, String worldName, @Nullable String[] allowList, @Nullable String[] blockList) Creates a new user script for script world with nameworldName
.static Type
getType()
Get the GType of the UserScript classref()
Atomically increments the reference count of this UserScript by one.void
unref()
Atomically decrements the reference count of this UserScript by one.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
UserScript
Create a UserScript proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
UserScript
public UserScript(String source, UserContentInjectedFrames injectedFrames, UserScriptInjectionTime injectionTime, @Nullable @Nullable String[] allowList, @Nullable @Nullable String[] blockList) throws UnsupportedPlatformException Creates a new user script.Scripts can be applied to some URIs only by passing non-null values for
allowList
orblockList
. Passing anull
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.- Parameters:
source
- Source code of the user script.injectedFrames
- AWebKitUserContentInjectedFrames
valueinjectionTime
- AWebKitUserScriptInjectionTime
valueallowList
- An allow_list of URI patterns ornull
blockList
- A block_list of URI patterns ornull
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
-
Method Details
-
getType
-
forWorld
public static UserScript forWorld(String source, UserContentInjectedFrames injectedFrames, UserScriptInjectionTime injectionTime, String worldName, @Nullable @Nullable String[] allowList, @Nullable @Nullable String[] blockList) Creates a new user script for script world with nameworldName
.See webkit_user_script_new() for a full description.
- Parameters:
source
- Source code of the user script.injectedFrames
- AWebKitUserContentInjectedFrames
valueinjectionTime
- AWebKitUserScriptInjectionTime
valueworldName
- the name of aWebKitScriptWorld
allowList
- An allow_list of URI patterns ornull
blockList
- A block_list of URI patterns ornull
- Returns:
- A new
WebKitUserScript
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
ref
Atomically increments the reference count of this UserScript by one.This function is MT-safe and may be called from any thread.
- Returns:
- The passed
WebKitUserScript
-
unref
public void unref()Atomically decrements the reference count of this UserScript by one.If the reference count drops to 0, all memory allocated by
WebKitUserScript
is released. This function is MT-safe and may be called from any thread.
-