WebKit2.SecurityOrigin

Fields

None

Methods

class

new (protocol, host, port)

class

new_for_uri (uri)

get_host ()

get_port ()

get_protocol ()

is_opaque ()

ref ()

to_string ()

unref ()

Details

class WebKit2.SecurityOrigin

A security boundary for websites.

WebKit2.SecurityOrigin 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 None, the origins should not be treated as equal.

New in version 2.16.

classmethod new(protocol, host, port)
Parameters:
  • protocol (str) – The protocol for the new origin

  • host (str) – The host for the new origin

  • port (int) – The port number for the new origin, or 0 to indicate the default port for protocol

Returns:

A WebKit2.SecurityOrigin.

Return type:

WebKit2.SecurityOrigin

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

New in version 2.16.

classmethod new_for_uri(uri)
Parameters:

uri (str) – The URI for the new origin

Returns:

A WebKit2.SecurityOrigin.

Return type:

WebKit2.SecurityOrigin

Create a new security origin from the provided.

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

New in version 2.16.

get_host()
Returns:

The host of the WebKit2.SecurityOrigin

Return type:

str or None

Gets the hostname of self.

It is reasonable for this to be None if its protocol does not require a host component.

New in version 2.16.

get_port()
Returns:

The port of the WebKit2.SecurityOrigin.

Return type:

int

Gets the port of self.

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 WebKit2.SecurityOrigin constructed from either URI.

New in version 2.16.

get_protocol()
Returns:

The protocol of the WebKit2.SecurityOrigin

Return type:

str or None

Gets the protocol of self.

New in version 2.16.

is_opaque()
Returns:

False

Return type:

bool

This function returns False.

This function returns False. WebKit2.SecurityOrigin 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.

New in version 2.16.

Deprecated since version 2.32.

ref()
Returns:

The passed WebKit2.SecurityOrigin

Return type:

WebKit2.SecurityOrigin

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.16.

to_string()
Returns:

a URI representing self.

Return type:

str or None

Gets a string representation of self.

The string representation is a valid URI with only protocol, host, and port components, or None.

New in version 2.16.

unref()

Atomically decrements the reference count of self by one.

If the reference count drops to 0, all memory allocated by WebKit2.SecurityOrigin is released. This function is MT-safe and may be called from any thread.

New in version 2.16.