-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This project has as a goal to improve WPT tests related with shared memory and agent clusters.
The latest JavaScript standard features a shared memory mechanism (SharedArrayBuffer) that allows different processes to shared memory. In a JavaScript engine, the equivalent of a process or thread is an agent. An agent defines a independent execution context with its own environment and execution stack. Normally, in a browser a JavaScript engine will correspond to worker (DedicatedWorker, SharedWorker and ServiceWorker) or to a a different window or iframe inside the same-origin of the parent window.
An agent cluster is a combination of agents. For instance:
- A window that starts a DedicatedWorker creates an agent cluster.
- A SharedWorker can also start one or many workers (DedicatedWorker, SharedWorker, ServiceWorker).
Depending on the type of agent cluster, the HTML standard defines whether is possible to share memory between the agents that conform the cluster or not.
The following pairs of global objects are each within the same agent cluster, and thus can use SharedArrayBuffer instances to share memory with each other:
- A Window object and a dedicated worker that it created.
- A worker (of any type) and a dedicated worker it created.
- A Window object A and the Window object of an iframe element that A created that could be same origin-domain with A.
- A Window object and a same origin-domain Window object that opened it.
The following pairs of global objects are not within the same agent cluster, and thus cannot share memory:
- A Window object and a shared worker it created.
- A worker (of any type) and a shared worker it created.
- A Window object and a service worker it created.
- A Window object and the Window object of an iframe element that A created that cannot be same origin-domain with A.