WebKitSecurityOrigin: WebKitGTK Reference Manual

## WebKitSecurityOrigin WebKitSecurityOrigin — A security boundary for websites |

## Functions

WebKitSecurityOrigin * | webkit_security_origin_new ()
WebKitSecurityOrigin * | webkit_security_origin_new_for_uri ()
WebKitSecurityOrigin * | webkit_security_origin_ref ()
void | webkit_security_origin_unref ()
const gchar * | webkit_security_origin_get_protocol ()
const gchar * | webkit_security_origin_get_host ()
guint16 | webkit_security_origin_get_port ()
gboolean | webkit_security_origin_is_opaque ()
gchar * | webkit_security_origin_to_string ()

## Types and Values

| WebKitSecurityOrigin

## Object Hierarchy

        GBoxed
        ╰── WebKitSecurityOrigin

## Description

WebKitSecurityOrigin is a representation of a security domain defined by websites. A security origin consists of a protocol, a hostname, and an optional port number.

Resources with the same security origin can generally access each other for client-side scripting or database access. When comparing origins, beware that if both protocol and host are `NULL`, the origins should not be treated as equal.

## Functions

### webkit_security_origin_new ()

    WebKitSecurityOrigin *
    webkit_security_origin_new (const gchar *protocol,
                                const gchar *host,
                                guint16 port);

Create a new security origin from the provided protocol, host and port.

#### Parameters

protocol | The protocol for the new origin |
host | The host for the new origin |
port | The port number for the new origin, or 0 to indicate the default port for `protocol` |

#### Returns

A WebKitSecurityOrigin.

[transfer full]

Since: 2.16

### webkit_security_origin_new_for_uri ()

    WebKitSecurityOrigin *
    webkit_security_origin_new_for_uri (const gchar *uri);

Create a new security origin from the provided URI. Components of `uri` other than protocol, host, and port do not affect the created WebKitSecurityOrigin.

#### Parameters

uri | The URI for the new origin |

#### Returns

A WebKitSecurityOrigin.

[transfer full]

Since: 2.16

### webkit_security_origin_ref ()

    WebKitSecurityOrigin *
    webkit_security_origin_ref (WebKitSecurityOrigin *origin);

Atomically increments the reference count of `origin` by one. This function is MT-safe and may be called from any thread.

#### Parameters

origin | a WebKitSecurityOrigin |

#### Returns

The passed WebKitSecurityOrigin

Since: 2.16

### webkit_security_origin_unref ()

    void
    webkit_security_origin_unref (WebKitSecurityOrigin *origin);

Atomically decrements the reference count of `origin` by one. If the reference count drops to 0, all memory allocated by WebKitSecurityOrigin is released. This function is MT-safe and may be called from any thread.

#### Parameters

origin | A WebKitSecurityOrigin |

Since: 2.16

### webkit_security_origin_get_protocol ()

    const gchar *
    webkit_security_origin_get_protocol (WebKitSecurityOrigin *origin);

Gets the protocol of `origin` .

#### Parameters

origin | a WebKitSecurityOrigin |

#### Returns

The protocol of the WebKitSecurityOrigin.

[allow-none]

Since: 2.16

### webkit_security_origin_get_host ()

    const gchar *
    webkit_security_origin_get_host (WebKitSecurityOrigin *origin);

Gets the hostname of `origin` . It is reasonable for this to be `NULL` if its protocol does not require a host component.

#### Parameters

origin | a WebKitSecurityOrigin |

#### Returns

The host of the WebKitSecurityOrigin.

[allow-none]

Since: 2.16

### webkit_security_origin_get_port ()

    guint16
    webkit_security_origin_get_port (WebKitSecurityOrigin *origin);

Gets the port of `origin` . This function will always return 0 if the port is the default port for the given protocol. For example, http://example.com has the same security origin as http://example.com:80, and this function will return 0 for a WebKitSecurityOrigin constructed from either URI.

#### Parameters

origin | a WebKitSecurityOrigin |

#### Returns

The port of the WebKitSecurityOrigin.

Since: 2.16

### webkit_security_origin_is_opaque ()

    gboolean
    webkit_security_origin_is_opaque (WebKitSecurityOrigin *origin);

`webkit_security_origin_is_opaque` has been deprecated since version 2.32 and should not be used in newly-written code.

This function returns `FALSE`. WebKitSecurityOrigin is now a simple wrapper around a <protocol, host, port> triplet, and no longer represents an origin as defined by web standards that may be opaque.

#### Parameters

origin | a WebKitSecurityOrigin |

#### Returns

`FALSE`

Since: 2.16

### webkit_security_origin_to_string ()

    gchar *
    webkit_security_origin_to_string (WebKitSecurityOrigin *origin);

Gets a string representation of `origin` . The string representation is a valid URI with only protocol, host, and port components, or `NULL`.

#### Parameters

origin | a WebKitSecurityOrigin |

#### Returns

a URI representing `origin` .

[allow-none][transfer full]

Since: 2.16

## Types and Values

### WebKitSecurityOrigin

    typedef struct _WebKitSecurityOrigin WebKitSecurityOrigin;