@@ -2927,6 +2927,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
2927
2927
2928
2928
<li>The <dfn data-x="js-abstract-equality" data-x-href="https://tc39.es/ecma262/#sec-abstract-equality-comparison">Abstract Equality Comparison</dfn> algorithm</li>
2929
2929
<li>The <dfn data-x="js-strict-equality" data-x-href="https://tc39.es/ecma262/#sec-strict-equality-comparison">Strict Equality Comparison</dfn> algorithm</li>
2930
+ <li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-atomics-object"><code>Atomics</code></dfn> object</li>
2930
2931
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-date-objects"><code>Date</code></dfn> class</li>
2931
2932
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-regexp-regular-expression-objects"><code>RegExp</code></dfn> class</li>
2932
2933
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-sharedarraybuffer-objects"><code>SharedArrayBuffer</code></dfn> class</li>
@@ -79174,6 +79175,31 @@ interface <dfn>BarProp</dfn> {
79174
79175
</table>
79175
79176
</div>
79176
79177
79178
+ <h4>Sites</h4>
79179
+
79180
+ <p>A <dfn data-export="">scheme-and-registrable-domain</dfn> is a <span>tuple</span> of a <span
79181
+ data-x="concept-url-scheme">scheme</span> and a <span data-x="concept-domain">domain</span>.</p>
79182
+
79183
+ <p>A <dfn data-export="">site</dfn> is an <span data-x="concept-origin-opaque">opaque
79184
+ origin</span>, a <span data-x="concept-origin-tuple">tuple origin</span> whose <span
79185
+ data-x="concept-origin-host">host</span>'s <span>registrable domain</span> is null, or a
79186
+ <span>scheme-and-registrable-domain</span>.</p>
79187
+
79188
+ <p>To <dfn data-export="">obtain a site</dfn>, given an origin <var>origin</var>, run these
79189
+ steps:</p>
79190
+
79191
+ <ol>
79192
+ <li><p>If <var>origin</var> is an <span data-x="concept-origin-opaque">opaque origin</span>, then
79193
+ return <var>origin</var>.</p></li>
79194
+
79195
+ <li><p>If <var>origin</var>'s <span data-x="concept-origin-host">host</span>'s <span>registrable
79196
+ domain</span> is null, then return <var>origin</var>.</p></li>
79197
+
79198
+ <li><p>Return (<var>origin</var>'s <span data-x="concept-origin-scheme">scheme</span>,
79199
+ <var>origin</var>'s <span data-x="concept-origin-host">host</span>'s <span>registrable
79200
+ domain</span>).</p></li>
79201
+ </ol>
79202
+
79177
79203
<p>Two <span data-x="origin">origins</span>, <var>A</var> and <var>B</var>, are said to be <dfn
79178
79204
data-export="">schemelessly same site</dfn> if the following algorithm returns true:</p>
79179
79205
@@ -88345,79 +88371,73 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88345
88371
<li><p>Return « Record { [[Key]]: "url", [[Value]]: <var>urlString</var> } ».</p></li>
88346
88372
</ol>
88347
88373
88374
+ </div>
88375
+
88348
88376
<h5>Integration with the JavaScript agent formalism</h5>
88349
88377
88350
88378
<p>JavaScript defines the concept of an <span>agent</span>. This section gives the mapping of that
88351
88379
language-level concept on to the web platform.</p>
88352
88380
88353
- <p class="XXX">JavaScript is expected to define <span data-x="agent">agents</span> in more detail,
88354
- in particular that <span data-x="JavaScript realm">realms</span> have a pointer to their agent.
88355
- See <a href="https://github.com/tc39/ecma262/issues/1357">tc39/ecma262 issue #1357</a>. The
88356
- algorithms which allocate new realms that belong to <span data-x="similar-origin window
88357
- agent">similar-origin window agents</span> include this pointer. For other realms, the following
88358
- section describes the relationship.</p>
88359
-
88360
88381
<div class="note">
88361
88382
<p>Conceptually, the <span>agent</span> concept is an architecture-independent, idealized
88362
88383
"thread" in which JavaScript code runs. Such code can involve multiple globals/<span
88363
88384
data-x="concept-global-object-realm">realms</span> that can synchronously access each other, and
88364
88385
thus needs to run in a single execution thread.</p>
88365
88386
88366
- <p>Two <code>Window</code> objects having the same <span>agent</span> does not indicate they can
88367
- directly access all objects created in each other's realms. They would have to be <span>same
88368
- origin-domain</span>; see <span>IsPlatformObjectSameOrigin</span>.</p>
88387
+ <p w-nodev >Two <code>Window</code> objects having the same <span>agent</span> does not indicate
88388
+ they can directly access all objects created in each other's realms. They would have to be
88389
+ <span>same origin-domain</span>; see <span>IsPlatformObjectSameOrigin</span>.</p>
88369
88390
</div>
88370
88391
88371
- <p>To <dfn data-export="" data-lt="similar-origin window agent" data-x="similar-origin window
88372
- agent">create a similar-origin window agent</dfn>:</p>
88373
-
88374
- <ol>
88375
- <li><p>Let <var>signifier</var> be a new unique internal value.</p></li>
88392
+ <p>The following types of agents exist on the web platform:</p>
88376
88393
88377
- <li><p>Let <var>candidateExecution</var> be a new <span>candidate execution</span>.</p></li>
88378
-
88379
- <li><p>Return a new <span>agent</span> whose [[CanBlock]] is true, [[Signifier]] is
88380
- <var>signifier</var>, [[CandidateExecution]] is <var>candidateExecution</var>, and
88381
- [[IsLockFree1]], [[IsLockFree2]], and [[LittleEndian]] are set at the implementation's
88382
- discretion.</p></li>
88383
- </ol>
88384
-
88385
- <p class="note">All global objects that use this agent all have a similar <span>origin</span> and
88386
- are allocated via the <span data-x="obtain-similar-origin-window-agent">obtain similar-origin
88387
- window agent</span> algorithm.</p>
88394
+ <dl>
88395
+ <dt><dfn data-export="">Similar-origin window agent</dfn></dt>
88396
+ <dd>
88397
+ <p>Contains various <code>Window</code> objects which can potentially reach each other, either
88398
+ directly or by using <code data-x="dom-document-domain">document.domain</code>.</p>
88388
88399
88389
- <p>In addition to the above definition for <span>similar-origin window agent</span>, until such a
88390
- time that this standard has a better handle on lifetimes, it defines the following other types of
88391
- <span data-x="agent">agents</span> that user agents must allocate at the appropriate time.</p>
88400
+ <p class="note">Two <code>Window</code> objects that are <span>same origin</span> can be in
88401
+ different <span data-x="similar-origin window agent">similar-origin window agents</span>, for
88402
+ instance if they are each in their own <span>browsing context group</span>.</p>
88403
+ </dd>
88392
88404
88393
- <dl>
88394
88405
<dt><dfn data-export="">Dedicated worker agent</dfn></dt>
88395
- <dd><p>An <span>agent</span> whose [[CanBlock]] is true and whose set of <span data-x="JavaScript
88396
- realm">realms</span> consists of a single <code>DedicatedWorkerGlobalScope</code> object's <span
88397
- data-x="concept-global-object-realm">Realm</span>.</p></dd>
88406
+ <dd><p>Contains a single <code>DedicatedWorkerGlobalScope</code>.</p></dd>
88398
88407
88399
88408
<dt><dfn data-export="">Shared worker agent</dfn></dt>
88400
- <dd><p>An <span>agent</span> whose [[CanBlock]] is true and whose set of <span data-x="JavaScript
88401
- realm">realms</span> consists a single <code>SharedWorkerGlobalScope</code> object's <span
88402
- data-x="concept-global-object-realm">Realm</span>.</p></dd>
88409
+ <dd><p>Contains a single <code>SharedWorkerGlobalScope</code>.</p></dd>
88403
88410
88404
88411
<dt><dfn data-export="">Service worker agent</dfn></dt>
88405
- <dd><p>An <span>agent</span> whose [[CanBlock]] is false and whose set of <span data-x="JavaScript
88406
- realm">realms</span> consists of a single <code>ServiceWorkerGlobalScope</code> object's <span
88407
- data-x="concept-global-object-realm">Realm</span>.</p></dd>
88412
+ <dd><p>Contains a single <code>ServiceWorkerGlobalScope</code>.</p></dd>
88408
88413
88409
88414
<dt><dfn data-export="">Worklet agent</dfn></dt>
88410
88415
<dd>
88411
- <p>An <span>agent</span> whose [[CanBlock]] is false and whose set of <span
88412
- data-x="JavaScript realm">realms</span> consists of a single <code>WorkletGlobalScope</code>
88413
- object's <span data-x="concept-global-object-realm">Realm</span>.</p>
88416
+ <p>Contains a single <code>WorkletGlobalScope</code> object.</p>
88414
88417
88415
88418
<p class="note">Although a given worklet can have multiple realms, each such realm needs its own
88416
88419
agent, as each realm can be executing code independently and at the same time as the others.</p>
88417
88420
</dd>
88418
88421
</dl>
88419
88422
88420
- <hr>
88423
+ <p>Only <span data-x="shared worker agent">shared</span> and <span data-x="dedicated worker
88424
+ agent">dedicated worker agents</span> allow the use of JavaScript <code>Atomics</code> APIs to
88425
+ potentially <span data-x="forward progress">block</span>.</p>
88426
+
88427
+ <div w-nodev>
88428
+
88429
+ <p>To <dfn>create an agent</dfn>, given a boolean <var>canBlock</var>:</p>
88430
+
88431
+ <ol>
88432
+ <li><p>Let <var>signifier</var> be a new unique internal value.</p></li>
88433
+
88434
+ <li><p>Let <var>candidateExecution</var> be a new <span>candidate execution</span>.</p></li>
88435
+
88436
+ <li><p>Return a new <span>agent</span> whose [[CanBlock]] is <var>canBlock</var>, [[Signifier]] is
88437
+ <var>signifier</var>, [[CandidateExecution]] is <var>candidateExecution</var>, and
88438
+ [[IsLockFree1]], [[IsLockFree2]], and [[LittleEndian]] are set at the implementation's
88439
+ discretion.</p></li>
88440
+ </ol>
88421
88441
88422
88442
<p>The <dfn data-export="">relevant agent</dfn> for a <span>platform object</span>
88423
88443
<var>platformObject</var> is the <span>agent</span> whose set of <span data-x="JavaScript
@@ -88427,14 +88447,15 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88427
88447
<p class="note">The agent equivalent of the <span>current Realm Record</span> is the
88428
88448
<span>surrounding agent</span>.</p>
88429
88449
88450
+ </div>
88451
+
88430
88452
<h5>Integration with the JavaScript agent cluster formalism</h5>
88431
88453
88432
88454
<p>JavaScript also defines the concept of an <span>agent cluster</span>, which this standard maps
88433
- to the web platform using the <span>can share memory with</span> equivalence relation detailed
88434
- below, as well as explicit allocation of <span data-x="similar-origin window agent">similar-origin
88435
- window agents</span> to agent clusters. On the web platform, an <span>agent cluster</span>
88436
- consists of all <span data-x="agent">agents</span> in the same equivalence class with respect to
88437
- the <span>can share memory with</span> equivalence relation.</p>
88455
+ to the web platform by placing agents appropriately when they are created<span w-nodev> using the
88456
+ <span data-x="obtain-similar-origin-window-agent">obtain a similar-origin window agent</span> or
88457
+ <span data-x="obtaining a worker/worklet agent">obtain a worker/worklet agent</span>
88458
+ algorithms</span>.</p>
88438
88459
88439
88460
<p>The <span>agent cluster</span> concept is crucial for defining the JavaScript memory model, and
88440
88461
in particular among which <span data-x="agent">agents</span> the backing data of
@@ -88448,34 +88469,13 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88448
88469
ensure that web developers see interoperable behavior with regard to shared memory, even in the
88449
88470
face of varying and changing user agent process models.</p>
88450
88471
88472
+ <div w-nodev>
88473
+
88451
88474
<hr>
88452
88475
88453
88476
<p>The following defines the allocation of the <span data-x="agent cluster">agent clusters</span>
88454
88477
of <span data-x="similar-origin window agent">similar-origin window agents</span>.</p>
88455
88478
88456
- <p>A <dfn data-export="">scheme-and-registrable-domain</dfn> is a <span>tuple</span> of a <span
88457
- data-x="concept-url-scheme">scheme</span> and a <span data-x="concept-domain">domain</span>.</p>
88458
-
88459
- <p>A <dfn data-export="">site</dfn> is an <span data-x="concept-origin-opaque">opaque
88460
- origin</span>, a <span data-x="concept-origin-tuple">tuple origin</span> whose <span
88461
- data-x="concept-origin-host">host</span>'s <span>registrable domain</span> is null, or a
88462
- <span>scheme-and-registrable-domain</span>.</p>
88463
-
88464
- <p>To <dfn data-export="">obtain a site</dfn>, given an origin <var>origin</var>, run these
88465
- steps:</p>
88466
-
88467
- <ol>
88468
- <li><p>If <var>origin</var> is an <span data-x="concept-origin-opaque">opaque origin</span>, then
88469
- return <var>origin</var>.</p></li>
88470
-
88471
- <li><p>If <var>origin</var>'s <span data-x="concept-origin-host">host</span>'s <span>registrable
88472
- domain</span> is null, then return <var>origin</var>.</p></li>
88473
-
88474
- <li><p>Return (<var>origin</var>'s <span data-x="concept-origin-scheme">scheme</span>,
88475
- <var>origin</var>'s <span data-x="concept-origin-host">host</span>'s <span>registrable
88476
- domain</span>).</p></li>
88477
- </ol>
88478
-
88479
88479
<p>An <dfn>agent cluster key</dfn> is a <span>site</span>.</p>
88480
88480
88481
88481
<p class="XXX"><a href="https://github.com/whatwg/html/pull/4734">whatwg/html #4734</a> is
@@ -88514,8 +88514,8 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88514
88514
<ol>
88515
88515
<li><p>Let <var>agentCluster</var> be a new <span>agent cluster</span>.</p></li>
88516
88516
88517
- <li><p>Add the result of <span data-x="similar-origin window agent">creating a similar-origin
88518
- window agent</span> to <var>agentCluster</var>.</p></li>
88517
+ <li><p>Add the result of <span data-x="create an agent">creating an agent</span>, given false,
88518
+ to <var>agentCluster</var>.</p></li>
88519
88519
88520
88520
<li><p>Set <var>group</var>'s <span>agent cluster map</span>[<var>key</var>] to
88521
88521
<var>agentCluster</var>.</p></li>
@@ -88526,47 +88526,67 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88526
88526
</ol>
88527
88527
88528
88528
<p class="note">This means that there is only one <span>similar-origin window agent</span> per
88529
- browsing context agent cluster. (However, other types of agents might be in the same cluster, if
88530
- they <span>can share memory with</span> the similar-origin window agent.)</p>
88529
+ browsing context agent cluster. (However, <span data-x="dedicated worker agent">dedicated
88530
+ worker</span> and <span data-x="worklet agent">worklet agents</span> might be in the same
88531
+ cluster.)</p>
88531
88532
88532
88533
<hr>
88533
88534
88534
- <p>The allocation of other types of agents to agent clusters is done via the following <dfn>can
88535
- share memory with</dfn> equivalence relation. Until such a time that this standard has a better
88536
- handle on the lifetimes of those sorts of agents, user agents must allocate new agent clusters, or
88537
- reuse ones created via <span data-x="obtain-browsing-agent-cluster">obtain a browsing context
88538
- agent cluster</span>, in order to ensure that there is an agent cluster for each equivalence class
88539
- of <span>can share memory with</span>.</p>
88535
+ <p>The following defines the allocation of the <span data-x="agent cluster">agent clusters</span>
88536
+ of all other types of agents.</p>
88540
88537
88541
- <p>A <span>similar-origin window agent</span>, <span>dedicated worker agent</span>, <span>shared
88542
- worker agent</span>, or <span>service worker agent</span>, <var>agent</var>, <span>can share
88543
- memory with</span> any <span>dedicated worker agent</span> whose single <span data-x="JavaScript
88544
- realm">realm</span>'s <span data-x="concept-realm-global">global object</span>'s <span>owner
88545
- set</span> contains an item whose <span>relevant agent</span> is <var>agent</var>.</p>
88538
+ <p>To <dfn data-x="obtaining a worker/worklet agent">obtain a worker/worklet agent</dfn>, given an
88539
+ <span>environment settings object</span> <var>owner</var>, a boolean <var>isTopLevel</var>, and a
88540
+ boolean <var>canBlock</var>, run these steps:</p>
88546
88541
88547
- <p class="note">"Item" is used above as an <span>owner set</span> can contain
88548
- <code>Document</code> objects.</p>
88542
+ <ol>
88543
+ <li>
88544
+ <p>If <var>isTopLevel</var> is true:</p>
88549
88545
88550
- <p>A <span>similar-origin window agent</span> <var>agent</var> <span>can share memory with</span>
88551
- any <span>worklet agent</span> whose single <span data-x="JavaScript realm">realm</span>'s
88552
- <span data-x="concept-realm-global">global object</span>'s
88553
- <span data-x="concept-worklet-owner-document">owner document</span>'s <span>relevant agent</span>
88554
- is <var>agent</var>.</p>
88546
+ <ol>
88547
+ <li><p>Let <var>agentCluster</var> be a new <span>agent cluster</span>.</p></li>
88555
88548
88556
- <p>In addition, any <span>agent</span> <var>A</var> <span>can share memory with</span>:</p>
88549
+ <li><p>Let <var>agent</var> be the result of <span data-x="create an agent">creating an
88550
+ agent</span> given <var>canBlock</var>.</p></li>
88557
88551
88558
- <ul class="brief">
88559
- <li><var>A</var>,</li>
88552
+ <li><p>Add <var>agent</var> to <var>agentCluster</var>.</p></li>
88560
88553
88561
- <li>any <span>agent</span> <var>B</var> such that <var>B</var> <span>can share memory with</span>
88562
- <var>A</var>, and</li>
88554
+ <li><p>Return <var>agent</var>.</p></li>
88555
+ </ol>
88556
+ </li>
88563
88557
88564
- <li>any <span>agent</span> <var>B</var> such that there exists an <span>agent</span>
88565
- <var>C</var>, where <var>A</var> <span>can share memory with</span> <var>C</var> and <var>C</var>
88566
- <span>can share memory with</span> <var>B</var>.</li>
88567
- </ul>
88558
+ <li><p>Let <var>ownerAgent</var> be <var>owner</var>'s <span data-x="environment settings
88559
+ object's Realm">Realm</span>'s agent.</p></li>
88568
88560
88569
- <div class="example">
88561
+ <li><p>Let <var>ownerAgentCluster</var> be the agent cluster which contains
88562
+ <var>ownerAgent</var>.</p></li>
88563
+
88564
+ <li><p>Let <var>agent</var> be the result of <span data-x="create an agent">creating an
88565
+ agent</span> given <var>canBlock</var>.</p></li>
88566
+
88567
+ <li><p>Add <var>agent</var> to <var>ownerAgentCluster</var>.</p></li>
88568
+
88569
+ <li><p>Return <var>agent</var>.</p></li>
88570
+ </ol>
88571
+
88572
+ <p>To <dfn>obtain a dedicated/shared worker agent</dfn>, given an <span>environment settings
88573
+ object</span> <var>owner</var> and a boolean <var>isShared</var>, return the result of
88574
+ <span>obtaining a worker/worklet agent</span> given <var>owner</var>, <var>isShared</var>, and
88575
+ true.</p>
88576
+
88577
+ <p>To <dfn data-export="">obtain a worklet agent</dfn>, given an <span>environment settings
88578
+ object</span> <var>owner</var>, return the result of <span>obtaining a worker/worklet
88579
+ agent</span> given <var>owner</var>, false, and false.</p>
88580
+
88581
+ <p>To <dfn data-export="">obtain a service worker agent</dfn>, given an <span>environment settings
88582
+ object</span> <var>owner</var>, return the result of <span>obtaining a worker/worklet
88583
+ agent</span> given <var>owner</var>, true, and false.</p>
88584
+
88585
+ <hr>
88586
+
88587
+ </div>
88588
+
88589
+ <div class="example" id="can-share-memory-with">
88570
88590
<p>The following pairs of global objects are each within the same <span>agent cluster</span>, and
88571
88591
thus can use <code>SharedArrayBuffer</code> instances to share memory with each other:</p>
88572
88592
@@ -88606,8 +88626,6 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
88606
88626
</ul>
88607
88627
</div>
88608
88628
88609
- </div>
88610
-
88611
88629
88612
88630
<h5 id="runtime-script-errors">Runtime script errors</h5>
88613
88631
@@ -97887,15 +97905,6 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
97887
97905
<var>options</var>, it must run the following steps.</p>
97888
97906
97889
97907
<ol>
97890
- <li id="worker-processing-model-top">
97891
-
97892
- <p>Create a separate parallel execution environment (i.e. a separate thread or process or
97893
- equivalent construct), and run the rest of these steps in that context.</p>
97894
-
97895
- <p>For the purposes of timing APIs, this is the <dfn data-export="">official moment of
97896
- creation</dfn> of the worker.</p>
97897
- </li>
97898
-
97899
97908
<li><p>Let <var>is shared</var> be true if <var>worker</var> is a <code>SharedWorker</code>
97900
97909
object, and false otherwise.</p></li>
97901
97910
@@ -97907,11 +97916,24 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
97907
97916
<li><p>If <var>owner</var> is a <code>WorkerGlobalScope</code> object (i.e., we are creating a
97908
97917
nested worker), then set <var>parent worker global scope</var> to <var>owner</var>.</p></li>
97909
97918
97919
+ <li>
97920
+ <p>Let <var>agent</var> be the result of <span data-x="obtain a dedicated/shared worker
97921
+ agent">obtaining a dedicated/shared worker agent</span> given <var>outside settings</var> and
97922
+ <var>is shared</var>.</p>
97923
+
97924
+ <p id="worker-processing-model-top">For the purposes of timing APIs, this is the <dfn
97925
+ data-export="">official moment of creation</dfn> of the worker.</p>
97926
+ </li>
97927
+
97910
97928
<li>
97911
97929
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
97912
97930
realm</span> with the following customizations:</p>
97913
97931
97914
97932
<ul>
97933
+ <li><p>For the agent, use <var>agent</var>. <span class="XXX" data-x="">This pointer is not yet
97934
+ defined in the JavaScript specification; see <a
97935
+ href="https://github.com/tc39/ecma262/issues/1357">tc39/ecma262#1357</a>.</span></p></li>
97936
+
97915
97937
<li><p>For the global object, if <var>is shared</var> is true, create a new
97916
97938
<code>SharedWorkerGlobalScope</code> object. Otherwise, create a new
97917
97939
<code>DedicatedWorkerGlobalScope</code> object.</p></li>
0 commit comments