WebKitScriptWorld: WebKitGTK Reference Manual

## WebKitScriptWorld WebKitScriptWorld |

## Functions

WebKitScriptWorld * | webkit_script_world_get_default ()
WebKitScriptWorld * | webkit_script_world_new ()
WebKitScriptWorld * | webkit_script_world_new_with_name ()
const char * | webkit_script_world_get_name ()

## Signals

void | window-object-cleared | Run Last

## Types and Values

struct | WebKitScriptWorld

## Object Hierarchy

        GObject
        ╰── WebKitScriptWorld

## Description

## Functions

### webkit_script_world_get_default ()

    WebKitScriptWorld *
    webkit_script_world_get_default (void);

Get the default WebKitScriptWorld. This is the normal script world where all scripts are executed by default. You can get the JavaScript execution context of a WebKitScriptWorld for a given WebKitFrame with `webkit_frame_get_javascript_context_for_script_world()`.

#### Returns

the default WebKitScriptWorld.

[transfer none]

Since: 2.2

### webkit_script_world_new ()

    WebKitScriptWorld *
    webkit_script_world_new (void);

Creates a new isolated WebKitScriptWorld. Scripts executed in isolated worlds have access to the DOM but not to other variable or functions created by the page. The WebKitScriptWorld is created with a generated unique name. Use `webkit_script_world_new_with_name()` if you want to create it with a custom name. You can get the JavaScript execution context of a WebKitScriptWorld for a given WebKitFrame with `webkit_frame_get_javascript_context_for_script_world()`.

#### Returns

a new isolated WebKitScriptWorld.

[transfer full]

Since: 2.2

### webkit_script_world_new_with_name ()

    WebKitScriptWorld *
    webkit_script_world_new_with_name (const char *name);

Creates a new isolated WebKitScriptWorld with a name. Scripts executed in isolated worlds have access to the DOM but not to other variable or functions created by the page. You can get the JavaScript execution context of a WebKitScriptWorld for a given WebKitFrame with `webkit_frame_get_javascript_context_for_script_world()`.

#### Parameters

name | a name for the script world |

#### Returns

a new isolated WebKitScriptWorld.

[transfer full]

Since: 2.22

### webkit_script_world_get_name ()

    const char *
    webkit_script_world_get_name (WebKitScriptWorld *world);

Get the name of a WebKitScriptWorld.

#### Parameters

world | a WebKitScriptWorld |

#### Returns

the name of `world`

Since: 2.22

## Types and Values

### struct WebKitScriptWorld

    struct WebKitScriptWorld;

## Signal Details

### The `“window-object-cleared”` signal

    void
    user_function (WebKitScriptWorld *world,
                   WebKitWebPage     *page,
                   WebKitFrame       *frame,
                   gpointer           user_data)

Emitted when the JavaScript window object in a WebKitScriptWorld has been cleared. This is the preferred place to set custom properties on the window object using the JavaScriptCore API. You can get the window object of `frame` from the JavaScript execution context of `world` that is returned by `webkit_frame_get_javascript_context_for_script_world()`.

#### Parameters

world | the WebKitScriptWorld on which the signal is emitted |
page | a WebKitWebPage |
frame | the WebKitFrame to which `world` belongs |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.2