@@ -88378,19 +88378,26 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88378
88378
88379
88379
<h5>Integration with the JavaScript agent formalism</h5>
88380
88380
88381
- <p>JavaScript defines the concept of an <span>agent</span>. Until such a time that this standard
88382
- has a better handle on lifetimes, we define five types of <span data-x="agent">agents</span> that
88383
- user agents must allocate at the appropriate time.</p>
88384
-
88385
- <p class="note">In the future, when this specification has a better handle on lifetimes, we hope
88386
- to define exactly when <span data-x="agent">agents</span> and <span data-x="agent cluster">agent
88387
- clusters</span> are created.</p>
88381
+ <p>JavaScript defines the concept of an <span>agent</span>. This section gives the mapping of that
88382
+ language-level concept on to the web platform.</p>
88388
88383
88389
88384
<p class="XXX">JavaScript is expected to define <span
88390
88385
data-x="agent">agents</span> in more detail; in particular that they hold a set of <span
88391
88386
data-x="concept-global-object-realm">realms</span>: <a
88392
88387
href="https://github.com/tc39/ecma262/issues/882">tc39/ecma262 issue #882</a>.</p>
88393
88388
88389
+ <p class="note">Conceptually, the <span>agent</span> concept is an architecture-independent,
88390
+ idealized "thread" in which JavaScript code runs. Such code can involve multiple globals/<span
88391
+ data-x="concept-global-object-realm">realms</span> that can synchronously access each other, and
88392
+ thus need to run in a single execution thread.</p>
88393
+
88394
+ <p>Until such a time that this standard has a better handle on lifetimes, it defines five types of
88395
+ <span data-x="agent">agents</span> that user agents must allocate at the appropriate time.</p>
88396
+
88397
+ <p class="note">In the future, this standard hopes to define exactly when <span
88398
+ data-x="agent">agents</span> and <span data-x="agent cluster">agent clusters</span> are
88399
+ created.</p>
88400
+
88394
88401
<dl>
88395
88402
<dt><dfn data-export="">Similar-origin window agent</dfn></dt>
88396
88403
<dd>
@@ -88427,16 +88434,30 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88427
88434
data-x="JavaScript realm">realms</span> consists of a single <code>WorkletGlobalScope</code>
88428
88435
object's <span data-x="concept-global-object-realm">Realm</span>.</p>
88429
88436
88430
- <p class="note">While conceptually it might be cleaner for worklets that end up with multiple
88431
- realms to put all those in the same agent, it is not observable in practice .</p>
88437
+ <p class="note">Although a given worklet can have multiple realms, each such realm needs its own
88438
+ agent, as each realm can be executing code independently and at the same time as the others .</p>
88432
88439
</dd>
88433
88440
</dl>
88434
88441
88435
88442
<h5>Integration with the JavaScript agent cluster formalism</h5>
88436
88443
88437
- <p><dfn>Can share memory with</dfn> defines an equivalence relation. An <span>agent cluster</span>
88438
- consists of all <span data-x="agent">agents</span> in the same equivalence class with respect to
88439
- the <span>can share memory with</span> equivalence relation.</p>
88444
+ <p>JavaScript also defines the concept of an <span>agent cluster</span>, which this standard maps
88445
+ to the web platform using the <dfn>can share memory with</dfn> equivalence relation detailed
88446
+ below. On the web platform, an <span>agent cluster</span> consists of all <span
88447
+ data-x="agent">agents</span> in the same equivalence class with respect to the <span>can share
88448
+ memory with</span> equivalence relation.</p>
88449
+
88450
+ <p>The <span>agent cluster</span> concept is crucial for defining the JavaScript memory model, and
88451
+ in particular among which <span data-x="agent">agents</span> the backing data of
88452
+ <code>SharedArrayBuffer</code> objects can be shared.</p>
88453
+
88454
+ <p class="note">Conceptually, the <span>agent cluster</span> concept is an
88455
+ architecture-independent, idealized "process boundary" that groups together multiple "threads"
88456
+ (<span data-x="agent">agents</span>). The <span data-x="agent cluster">agent clusters</span>
88457
+ defined by the specification are generally more restrictive than the actual process boundaries
88458
+ implemented in user agents. By enforcing these idealized divisions at the specification level, we
88459
+ ensure that web developers see interoperable behavior with regard to shared memory, even in the
88460
+ face of varying and changing user agent process models.</p>
88440
88461
88441
88462
<p>A <span>similar-origin window agent</span>, <span>dedicated worker agent</span>, <span>shared
88442
88463
worker agent</span>, or <span>service worker agent</span>, <var>agent</var>, <span>can share
@@ -88445,8 +88466,8 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88445
88466
set</span> contains an item whose <span data-x="concept-relevant-realm">relevant Realm</span>
88446
88467
belongs to <var>agent</var>.</p>
88447
88468
88448
- <p class="note">We use item above as an <span>owner set</span> can contain <code>Document</code>
88449
- objects.</p>
88469
+ <p class="note">"Item" is used above as an <span>owner set</span> can contain
88470
+ <code>Document</code> objects.</p>
88450
88471
88451
88472
<p class="XXX">A <span>worklet agent</span> … currently worklets have
88452
88473
no clearly defined owner, see: <a
@@ -88466,10 +88487,6 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88466
88487
<span>can share memory with</span> <var>B</var>.</li>
88467
88488
</ul>
88468
88489
88469
- <p>The <span>agent cluster</span> concept is crucial for defining the JavaScript memory model, and
88470
- in particular among which <span data-x="agent">agents</span> the backing data of
88471
- <code>SharedArrayBuffer</code> objects can be shared.</p>
88472
-
88473
88490
<div class="example">
88474
88491
<p>The following pairs of global objects are each within the same <span>agent cluster</span>, and
88475
88492
thus can use <code>SharedArrayBuffer</code> instances to share memory with each other:</p>
@@ -88500,6 +88517,11 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88500
88517
<li>A <code>Window</code> object <var></var> and the <code>Window</code> object of an
88501
88518
<code>iframe</code> element that <var>A</var> created that cannot be <span>same
88502
88519
origin-domain</span> with <var>A</var>.</li>
88520
+
88521
+ <li>Any two <code>Window</code> objects whose <span data-x="browsing context">browsing
88522
+ contexts</span> do not have an <span data-x="opener browsing context">opener</span> or <span
88523
+ data-x="ancestor browsing context">ancestor</span> relationship. This holds even if the two
88524
+ <code>Window</code> objects are <span>same origin</span>.</li>
88503
88525
</ul>
88504
88526
</div>
88505
88527
0 commit comments