PermissionStore Class

The permissions that the user gave to the origins (https://w3c.github.io/permissions/#permission-store): the states read by navigator.permissions.query() (Permissions.Query). It plays the role of the permission prompts of a browser. The state of a permission that was not set is PermissionState.Prompt. A store can be shared by several browsing contexts (BrowsingContextOptions.Permissions), and used from any thread.

public sealed class PermissionStore

Remarks

The state is keyed by the top-level origin of the document that queries it (the permission key of the specification). The documents that are not allowed to use a feature by their permissions policy, and the documents and workers that are not secure contexts, see the permissions as PermissionState.Denied. Changing a state fires the change event of the PermissionStatus objects whose state changed.

Constructors

NameDescription
PermissionStore()

PermissionStore()

PermissionStore.cs
public PermissionStore()

No documentation is available.

Methods

NameDescription
GetState(string, string)Returns the state of a permission for a top-level origin.
SetState(string, PermissionState)Sets the state of a permission for every origin (and removes the states set for an origin).
SetState(string, string, PermissionState)Sets the state of a permission for a top-level origin.

GetState(string, string)

PermissionStore.cs

Returns the state of a permission for a top-level origin.

public PermissionState GetState(string name, string origin)

Parameters

name string
The name of the powerful feature (e.g. geolocation).
origin string
The serialization of the top-level origin (e.g. https://example.com).

Returns

PermissionState

SetState overloads

SetState(string, PermissionState)

PermissionStore.cs

Sets the state of a permission for every origin (and removes the states set for an origin).

public void SetState(string name, PermissionState state)
Parameters
name string
The name of the powerful feature (e.g. geolocation).
state PermissionState
The new state.

SetState(string, string, PermissionState)

PermissionStore.cs

Sets the state of a permission for a top-level origin.

public void SetState(string name, string origin, PermissionState state)
Parameters
name string
The name of the powerful feature (e.g. geolocation).
origin string
The serialization of the top-level origin (e.g. https://example.com).
state PermissionState
The new state.