3.18 <WebKitUserScript>

Structure: <WebKitUserScript>

A JavaScript snippet which can be injected in loaded pages.

Procedures

Procedure: user-script:new source injected-frames injection-time [allow-list] [block-list] ⇒ %return

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 #f 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.

source

Passed: a string.

Source code of the user script.

injected-frames

Passed: a <WebKitUserContentInjectedFrames>, or one of its symbols.

A <WebKitUserContentInjectedFrames> value

injection-time

Passed: a <WebKitUserScriptInjectionTime>, or one of its symbols.

A <WebKitUserScriptInjectionTime> value

allow-list

Passed, or left out: a list or vector, each a string, or #f.

An allow_list of URI patterns or #f

block-list

Passed, or left out: a list or vector, each a string, or #f.

A block_list of URI patterns or #f

%return

Returned: a <WebKitUserScript>.

A new <WebKitUserScript>

Procedure: user-script:new-for-world source injected-frames injection-time world-name [allow-list] [block-list] ⇒ %return

Creates a new user script for script world with name world-name.

See user-script:new for a full description.

source

Passed: a string.

Source code of the user script.

injected-frames

Passed: a <WebKitUserContentInjectedFrames>, or one of its symbols.

A <WebKitUserContentInjectedFrames> value

injection-time

Passed: a <WebKitUserScriptInjectionTime>, or one of its symbols.

A <WebKitUserScriptInjectionTime> value

world-name

Passed: a string.

the name of a WebKitScriptWorld

allow-list

Passed, or left out: a list or vector, each a string, or #f.

An allow_list of URI patterns or #f

block-list

Passed, or left out: a list or vector, each a string, or #f.

A block_list of URI patterns or #f

%return

Returned: a <WebKitUserScript>.

A new <WebKitUserScript>

Method: user-script:ref self ⇒ %return
Method: ref self ⇒ %return

Atomically increments the reference count of self by one.

This function is MT-safe and may be called from any thread.

self

Passed: a <WebKitUserScript>.

a <WebKitUserScript>

%return

Returned: a <WebKitUserScript>.

The passed <WebKitUserScript>

Method: user-script:unref self
Method: unref self

Atomically decrements the reference count of self 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.

self

Passed: a <WebKitUserScript>.

a <WebKitUserScript>