diff --git a/source b/source index e04a72deec1..6e18b6dd26a 100644 --- a/source +++ b/source @@ -2476,6 +2476,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute character
To create a new browsing context, given
- null or a Document
object creator:
Document
object creator and browsing context group
+ group:
+
+
Let browsingContext be a new browsing context.
Let featurePolicy be the result of creating a feature policy given browsingContext and origin.
Let agent be the result of obtaining a similar-origin window agent given + origin and group.
Let realm execution context be the result of creating a new JavaScript realm with the following customizations:
For the agent, use agent. This pointer is not yet defined + in the JavaScript specification; see tc39/ecma262#1357.
For the global object, create a new Window
object.
For the global this binding, use browsingContext's @@ -78178,15 +78193,17 @@ dictionary DragEventInit : MouseEventInit { context
Let browsingContext be the result of creating a new browsing - context with opener's active document.
Let group be opener's top-level browsing context's + group
Assert: opener's top-level browsing context's group is non-null, as navigating invokes this - directly.
Assert: group is non-null, as navigating invokes + this directly.
Append browsingContext to opener's - top-level browsing context's group.
Let browsingContext be the result of creating a new browsing + context with opener's active document and group.
Append browsingContext to + group.
Set browsingContext's opener browsing context to opener.
Let browsingContext be the result of creating a new browsing - context with element's node document.
Set element's nested browsing context to browsingContext.
A browsing context group holds a browsing context set (a set of top-level browsing contexts).
+A browsing context group has an associated agent cluster map (a weak + map of agent cluster + keys to agent clusters). User agents are responsible + for collecting agent clusters when it is deemed that nothing can access them anymore.
+To create a new browsing context group, run these steps:
@@ -78691,8 +78715,11 @@ console.assert(iframeWindow.frameElement === null);Append group to the user agent's browsing context group set.
Append the result of creating a new browsing - context with null to group.
Let browsingContext be the result of creating a new browsing + context with null and group.
Append browsingContext to + group.
Return group.
Let realm execution context be the result of creating a new JavaScript realm with the following customizations:
For the agent, use agent. This pointer is not + yet defined in the JavaScript specification; see tc39/ecma262#1357.
For the global object, create a new Window
object.
For the global this binding, use browsingContext's @@ -90374,80 +90410,47 @@ import "https://example.com/foo/../module2.mjs";
JavaScript defines the concept of an agent. This section gives the mapping of that language-level concept on to the web platform.
-JavaScript is expected to define agents in more detail; - in particular that they hold a set of realms: tc39/ecma262 issue #1357.
- -Conceptually, the agent concept is an architecture-independent, - idealized "thread" in which JavaScript code runs. Such code can involve multiple globals/realms that can synchronously access each other, and - thus needs to run in a single execution thread.
- -To determine whether a Window
object A and a Window
object
- B are considered same-agent Window
objects, run
- these steps:
If A's relevant settings object's responsible browsing - context's top-level browsing context's group is not B's relevant settings object's - responsible browsing context's top-level browsing context's group, then return false.
- -Unfortunately this model falls apart the moment a browsing context - is discarded. Issue #4361 sketches a setup that could - improve this situation.
-JavaScript is expected to define agents in more detail, + in particular that realms have a pointer to their agent. + See tc39/ecma262 issue #1357. The + algorithms which allocate new realms that belong to similar-origin window agents include this pointer. For other realms, the following + section describes the relationship.
-Let originA be A's relevant settings object's origin and originB be B's - relevant settings object's origin.
Conceptually, the agent concept is an architecture-independent, idealized + "thread" in which JavaScript code runs. Such code can involve multiple globals/realms that can synchronously access each other, and + thus needs to run in a single execution thread.
-If originA is same origin with originB, then return - true.
Two Window
objects having the same agent does not indicate they can
+ directly access all objects created in each other's realms. They would have to be same
+ origin-domain; see IsPlatformObjectSameOrigin.
If originA or originB is not a tuple origin, then return false.
To create a similar-origin window agent:
-If originA's scheme is not - originB's scheme, then return - false.
Let signifier be a new unique internal value.
If originA's host is same - site with originB's host, then return - true.
Let candidateExecution be a new candidate execution.
Return false.
Return a new agent whose [[CanBlock]] is true, [[Signifier]] is + signifier, [[CandidateExecution]] is candidateExecution, and + [[IsLockFree1]], [[IsLockFree2]], and [[LittleEndian]] are set at the implementation's + discretion.
All same-agent Window
objects together represent a group
- of Window
objects that can synchronously access each other, though sometimes only
- after setting the document.domain
attribute
- (in)appropriately.
All global objects that use this agent all have a similar origin and + are allocated via the obtain similar-origin + window agent algorithm.
-Until such a time that this standard has a better handle on lifetimes, it defines five types of +
In addition to the above definition for similar-origin window agent, until such a + time that this standard has a better handle on lifetimes, it defines the following other types of agents that user agents must allocate at the appropriate time.
-In the future, this standard hopes to define exactly when agents and agent clusters are - created.
-An agent whose [[CanBlock]] is false and whose set of realms consists of all realms of all same-agent Window
- objects.
Two Window
objects that are same origin can be in
- different similar-origin window agents, for
- instance if they are each in their own browsing context group.
An agent whose [[CanBlock]] is true and whose set of realms consists of a single JavaScript also defines the concept of an agent cluster, which this standard maps
- to the web platform using the can share memory with equivalence relation detailed
- below. On the web platform, an agent cluster consists of all agents in the same equivalence class with respect to the can share
- memory with equivalence relation.DedicatedWorkerGlobalScope
object's
Integration with the JavaScript agent cluster formalism
The agent cluster concept is crucial for defining the JavaScript memory model, and in particular among which agents the backing data of @@ -90504,6 +90508,84 @@ import "https://example.com/foo/../module2.mjs"; ensure that web developers see interoperable behavior with regard to shared memory, even in the face of varying and changing user agent process models.
+The following defines the allocation of the agent clusters + of similar-origin window agents.
+ +A scheme-and-registrable-domain is a tuple of a scheme and a domain.
+ +An agent cluster key is an origin or a + scheme-and-registrable-domain.
+ +To obtain an agent cluster key, given an origin + origin, run these steps:
+ +If origin is an opaque origin, then + return origin.
If origin's host's registrable + domain is null, then return origin.
Return (origin's scheme, + origin's host's registrable + domain).
To obtain a similar-origin window agent, + given an origin origin and browsing context group + group, run these steps:
+ +Let clusterKey be the result of obtaining an agent cluster key given + origin.
Let agentCluster be the result of obtaining a browsing context agent cluster with + group and clusterKey.
Return the single similar-origin window agent contained in + agentCluster.
To obtain a browsing context agent cluster, + given a browsing context group group and agent cluster key + key, run these steps:
+ +If group's agent cluster map[key] does not exist, then:
+Let agentCluster be a new agent cluster.
Add the result of creating a similar-origin + window agent to agentCluster.
Set group's agent cluster map[key] to + agentCluster.
Return group's agent cluster map[key].
This means that there is only one similar-origin window agent per + browsing context agent cluster. (However, other types of agents might be in the same cluster, if + they can share memory with the similar-origin window agent.)
+ +The allocation of other types of agents to agent clusters is done via the following can + share memory with equivalence relation. Until such a time that this standard has a better + handle on the lifetimes of those sorts of agents, user agents must allocate new agent clusters, or + reuse ones created via obtain a browsing context + agent cluster, in order to ensure that there is an agent cluster for each equivalence class + of can share memory with.
+A similar-origin window agent, dedicated worker agent, shared worker agent, or service worker agent, agent, can share memory with any dedicated worker agent whose single