WebKit.SecurityOrigin

Fields

None

Methods

class

new (protocol, host, port)

class

new_for_uri (uri)

get_host ()

get_port ()

get_protocol ()

ref ()

to_string ()

unref ()

Details

class WebKit.SecurityOrigin

A security boundary for websites.

WebKit.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 WebKit.SecurityOrigin.

Return type:

WebKit.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 WebKit.SecurityOrigin.

Return type:

WebKit.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 WebKit.SecurityOrigin.

New in version 2.16.

get_host()
Returns:

The host of the WebKit.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 WebKit.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 WebKit.SecurityOrigin constructed from either URI.

New in version 2.16.

get_protocol()
Returns:

The protocol of the WebKit.SecurityOrigin

Return type:

str or None

Gets the protocol of self.

New in version 2.16.

ref()
Returns:

The passed WebKit.SecurityOrigin

Return type:

WebKit.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 WebKit.SecurityOrigin is released. This function is MT-safe and may be called from any thread.

New in version 2.16.