StorageAccessHandle Class

The access of a document of a third-party context to the storage of its origin as a first party (the unpartitioned storage, https://privacycg.github.io/saa-non-cookie-storage/#storageaccesshandle), returned by Document.RequestStorageAccess: the members give the Web Storage areas, the IndexedDB databases, the locks, the caches, the origin private file system, the usage estimate, the broadcast channels and the shared workers of the storage key of the origin in a top-level document, instead of the ones of the partition of the document. A member that the StorageAccessTypes of the request did not include throws an InvalidStateError DomException (rejects its task).

public sealed class StorageAccessHandle

Remarks

The blob URLs are not partitioned by the library: StorageAccessHandle.CreateObjectUrl and StorageAccessHandle.RevokeObjectUrl are Url.CreateObjectUrl and Url.RevokeObjectUrl. A shared worker created by StorageAccessHandle.CreateSharedWorker is shared with the documents of the origin in their first-party contexts; the sameSiteCookies option of the shared workers is not implemented.

See also

Properties

NameDescription
IndexedDBGets the IndexedDB databases of the origin in its first-party contexts.
LocalStorageGets the local storage area of the origin in its first-party contexts (see Window.LocalStorage).
LocksGets the lock manager of the origin in its first-party contexts.
SessionStorageGets the session storage area of the origin in its first-party contexts of the top-level traversable (the area that the documents of the origin get from Window.SessionStorage when they are not embedded by another site).

Gets the IndexedDB databases of the origin in its first-party contexts.

public IdbFactory IndexedDB { get; }

Property value

IdbFactory

Exceptions

DomException
An InvalidStateError when IndexedDB was not requested.

See also

Gets the local storage area of the origin in its first-party contexts (see Window.LocalStorage).

public Storage LocalStorage { get; }

Property value

Storage

Exceptions

DomException
An InvalidStateError when the local storage was not requested, a SecurityError when the items cannot be loaded.

See also

Gets the lock manager of the origin in its first-party contexts.

public LockManager Locks { get; }

Property value

LockManager

Exceptions

DomException
An InvalidStateError when the locks were not requested.

See also

Gets the session storage area of the origin in its first-party contexts of the top-level traversable (the area that the documents of the origin get from Window.SessionStorage when they are not embedded by another site).

public Storage SessionStorage { get; }

Property value

Storage

Exceptions

DomException
An InvalidStateError when the session storage was not requested.

See also

Methods

NameDescription
CreateBroadcastChannel(string)Creates a broadcast channel that exchanges messages with the channels of the origin in its first-party contexts (instead of the channels of the partition of the document).
CreateObjectUrl(Blob)Creates a blob: URL referencing a blob (see Url.CreateObjectUrl).
CreateObjectUrl(MediaSource)Creates a blob: URL referencing a media source (see Url.CreateObjectUrl).
CreateSharedWorker(string, SharedWorkerOptions?)Connects to a shared worker of the origin in its first-party contexts (see SharedWorker).
CreateSharedWorker(string, string)Connects to a shared worker of the origin in its first-party contexts (see SharedWorker).
Estimate()Returns an estimation of the usage and of the quota of the storage of the origin in its first-party contexts (see StorageManager.Estimate). The task fails with an InvalidStateError when it was not requested.
GetDirectory()Returns the root directory of the origin private file system of the origin in its first-party contexts (see StorageManager.GetDirectory). The task fails with an InvalidStateError when it was not requested.
RevokeObjectUrl(string)Revokes a blob: URL (see Url.RevokeObjectUrl).

CreateBroadcastChannel(string)

StorageAccessHandle.cs

Creates a broadcast channel that exchanges messages with the channels of the origin in its first-party contexts (instead of the channels of the partition of the document).

public BroadcastChannel CreateBroadcastChannel(string name)

Parameters

name string

Returns

BroadcastChannel

Exceptions

DomException
An InvalidStateError when it was not requested.

See also

CreateObjectUrl overloads

CreateObjectUrl(Blob)

StorageAccessHandle.cs

Creates a blob: URL referencing a blob (see Url.CreateObjectUrl).

public string CreateObjectUrl(Blob obj)
Parameters
obj Blob
Returns

string

Exceptions
DomException
An InvalidStateError when it was not requested.
See also

CreateObjectUrl(MediaSource)

StorageAccessHandle.cs

Creates a blob: URL referencing a media source (see Url.CreateObjectUrl).

public string CreateObjectUrl(MediaSource obj)
Parameters
obj MediaSource
Returns

string

Exceptions
DomException
An InvalidStateError when it was not requested.
See also

CreateSharedWorker overloads

CreateSharedWorker(string, SharedWorkerOptions?)

StorageAccessHandle.cs

Connects to a shared worker of the origin in its first-party contexts (see SharedWorker).

public SharedWorker CreateSharedWorker(string scriptUrl, SharedWorkerOptions? options = null)
Parameters
scriptUrl string
options SharedWorkerOptions?
Returns

SharedWorker

Exceptions
DomException
An InvalidStateError when it was not requested, a SyntaxError when the URL is invalid.
See also

CreateSharedWorker(string, string)

StorageAccessHandle.cs

Connects to a shared worker of the origin in its first-party contexts (see SharedWorker).

public SharedWorker CreateSharedWorker(string scriptUrl, string name)
Parameters
scriptUrl string
name string
Returns

SharedWorker

Exceptions
DomException
An InvalidStateError when it was not requested, a SyntaxError when the URL is invalid.
See also

Returns an estimation of the usage and of the quota of the storage of the origin in its first-party contexts (see StorageManager.Estimate). The task fails with an InvalidStateError when it was not requested.

public Task<StorageEstimate> Estimate()

Returns the root directory of the origin private file system of the origin in its first-party contexts (see StorageManager.GetDirectory). The task fails with an InvalidStateError when it was not requested.

public Task<FileSystemDirectoryHandle> GetDirectory()

RevokeObjectUrl(string)

StorageAccessHandle.cs

Revokes a blob: URL (see Url.RevokeObjectUrl).

public void RevokeObjectUrl(string url)

Parameters

url string

Exceptions

DomException
An InvalidStateError when it was not requested.

See also