@@ -106119,23 +106119,23 @@ new PaymentRequest(…); // Allowed to use
106119
106119
callback">cleaning up after running a callback</span>, this value will be incremented and
106120
106120
decremented.</p>
106121
106121
106122
- <p>Every <span>event loop</span> has an associated <dfn>backup incumbent settings object
106123
- stack</dfn>, initially empty. Roughly speaking, it is used to determine the <span>incumbent
106124
- settings object</span> when no author code is on the stack, but author code is responsible for the
106125
- current algorithm having been run in some way. The process of <span data-x="prepare to run a
106126
- callback">preparing to run a callback</span> and <span data-x="clean up after running a
106127
- callback">cleaning up after running a callback</span> manipulate this stack. <ref>WEBIDL</ref></p>
106122
+ <p>Every <span>event loop</span> has an associated <dfn>backup incumbent realm stack</dfn>,
106123
+ initially empty. Roughly speaking, it is used to determine the <span
106124
+ data-x="concept-incumbent-realm">incumbent realm</span> when no author code is on the stack, but
106125
+ author code is responsible for the current algorithm having been run in some way.
106126
+ The process of <span data-x="prepare to run a callback">preparing to run a callback</span> and
106127
+ <span data-x="clean up after running a callback">cleaning up after running a callback</span>
106128
+ manipulate this stack. <ref>WEBIDL</ref></p>
106128
106129
106129
106130
<p>When Web IDL is used to <span data-x="es-invoking-callback-functions">invoke</span> author
106130
106131
code, or when <span>HostEnqueuePromiseJob</span> invokes a promise job, they use the following
106131
- algorithms to track relevant data for determining the <span>incumbent settings object</span>:</p>
106132
+ algorithms to track relevant data for determining the <span
106133
+ data-x="concept-incumbent-realm">incumbent realm</span>:</p>
106132
106134
106133
- <p>To <dfn export>prepare to run a callback</dfn> with an <span>environment settings object</span>
106134
- <var>settings</var>:</p>
106135
+ <p>To <dfn export>prepare to run a callback</dfn> with a <span>realm</span> <var>realm</var>:</p>
106135
106136
106136
106137
<ol>
106137
- <li><p>Push <var>settings</var> onto the <span>backup incumbent settings object
106138
- stack</span>.</p></li>
106138
+ <li><p>Push <var>realm</var> onto the <span>backup incumbent realm stack</span>.</p></li>
106139
106139
106140
106140
<li><p>Let <var>context</var> be the <span>topmost script-having execution
106141
106141
context</span>.</p></li>
@@ -106144,8 +106144,8 @@ new PaymentRequest(…); // Allowed to use
106144
106144
<span>skip-when-determining-incumbent counter</span>.</p></li>
106145
106145
</ol>
106146
106146
106147
- <p>To <dfn export>clean up after running a callback</dfn> with an <span>environment settings
106148
- object</span> < var>settings </var>:</p>
106147
+ <p>To <dfn export>clean up after running a callback</dfn> with a <span>realm</span>
106148
+ < var>realm </var>:</p>
106149
106149
106150
106150
<ol>
106151
106151
<li>
@@ -106159,19 +106159,18 @@ new PaymentRequest(…); // Allowed to use
106159
106159
<li><p>If <var>context</var> is not null, decrement <var>context</var>'s
106160
106160
<span>skip-when-determining-incumbent counter</span>.</p></li>
106161
106161
106162
- <li><p><span>Assert</span>: the topmost entry of the <span>backup incumbent settings object
106163
- stack</span> is < var>settings </var>.</p></li>
106162
+ <li><p><span>Assert</span>: the topmost entry of the <span>backup incumbent realm stack</span> is
106163
+ < var>realm </var>.</p></li>
106164
106164
106165
- <li><p>Remove <var>settings</var> from the <span>backup incumbent settings object
106166
- stack</span>.</p></li>
106165
+ <li><p>Remove <var>realm</var> from the <span>backup incumbent realm stack</span>.</p></li>
106167
106166
</ol>
106168
106167
106169
106168
<p>Here, the <dfn>topmost script-having execution context</dfn> is the topmost entry of the
106170
106169
<span>JavaScript execution context stack</span> that has a non-null ScriptOrModule component, or
106171
106170
null if there is no such entry in the <span>JavaScript execution context stack</span>.</p>
106172
106171
106173
- <p>With all this in place, the <dfn export>incumbent settings object </dfn> is determined as
106174
- follows:</p>
106172
+ <p>With all this in place, the <dfn export data-x="concept-incumbent-realm" >incumbent realm </dfn>
106173
+ is determined as follows:</p>
106175
106174
106176
106175
<ol>
106177
106176
<li><p>Let <var>context</var> be the <span>topmost script-having execution
@@ -106183,32 +106182,30 @@ new PaymentRequest(…); // Allowed to use
106183
106182
106184
106183
<ol>
106185
106184
<li>
106186
- <p><span>Assert</span>: the <span>backup incumbent settings object stack</span> is not
106187
- empty.</p>
106188
-
106189
- <p class="note">This assert would fail if you try to obtain the <span>incumbent settings
106190
- object</span> from inside an algorithm that was triggered neither by <a
106191
- href="#calling-scripts">calling scripts</a> nor by Web IDL <span
106192
- data-x="es-invoking-callback-functions">invoking</span> a callback. For example, it would
106193
- trigger if you tried to obtain the <span >incumbent settings object </span> inside an algorithm
106194
- that ran periodically as part of the <span>event loop</span>, with no involvement of author
106195
- code. In such cases the <span data-x="concept-incumbent-everything">incumbent</span> concept
106196
- cannot be used.</p>
106185
+ <p><span>Assert</span>: the <span>backup incumbent realm stack</span> is not empty.</p>
106186
+
106187
+ <p class="note">This assert would fail if you try to obtain the <span
106188
+ data-x="concept-incumbent-realm">incumbent realm</span> from inside an algorithm that was
106189
+ triggered neither by <a href="#calling-scripts">calling scripts</a> nor by Web IDL <span
106190
+ data-x="es-invoking-callback-functions">invoking</span> a callback.
106191
+ For example, it would trigger if you tried to obtain the <span
106192
+ data-x="concept-incumbent-realm" >incumbent realm </span> inside an algorithm that ran
106193
+ periodically as part of the <span>event loop</span>, with no involvement of author code.
106194
+ In such cases the <span data-x="concept-incumbent-everything">incumbent</span> concept cannot
106195
+ be used.</p>
106197
106196
</li>
106198
106197
106199
- <li><p>Return the topmost entry of the <span>backup incumbent settings object
106200
- stack</span>.</p></li>
106198
+ <li><p>Return the topmost entry of the <span>backup incumbent realm stack</span>.</p></li>
106201
106199
</ol>
106202
106200
</li>
106203
106201
106204
- <li><p>Return <var>context</var>'s Realm component's <span
106205
- data-x="concept-principal-realm-of-realm">principal realm</span>'s <span
106206
- data-x="concept-realm-settings-object">settings object</span>.</p></li>
106202
+ <li><p>Return <var>context</var>'s Realm component.</p></li>
106207
106203
</ol>
106208
106204
106209
- <p>Then, the <dfn export data-x="concept-incumbent-realm">incumbent realm</dfn> is the <span
106210
- data-x="environment settings object's realm">realm</span> of the <span>incumbent settings
106211
- object</span>.</p>
106205
+ <p>Then, the <dfn export>incumbent settings object</dfn> is the
106206
+ <span data-x="concept-incumbent-realm">incumbent realm</span>'s
106207
+ <span data-x="concept-principal-realm-of-realm">principal realm</span>'s
106208
+ <span data-x="concept-realm-settings-object">settings object</span>.</p>
106212
106209
106213
106210
<p>Similarly, the <dfn export data-x="concept-incumbent-global">incumbent global object</dfn> is
106214
106211
the <span data-x="concept-settings-object-global">global object</span> of the <span>incumbent
@@ -106228,10 +106225,10 @@ new PaymentRequest(…); // Allowed to use
106228
106225
frames[0].postMessage("some data", "*");
106229
106226
</script></code></pre>
106230
106227
106231
- <p>There are two interesting <span data-x="environment settings object">environment settings
106232
- objects</span> here: that of < code data-x="">window</code>, and that of <code
106233
- data-x="">frames[0]</code>. Our concern is: what is the <span>incumbent settings object </span> at
106234
- the time that the algorithm for <code data-x="dom-window-postMessage">postMessage()</code>
106228
+ <p>There are two interesting <span data-x="realm">realms</span> here: that of
106229
+ < code data-x="">window</code>, and that of <code data-x="">frames[0]</code>.
106230
+ Our concern is: what is the <span data-x="concept-incumbent-realm" >incumbent realm </span> at the
106231
+ time that the algorithm for <code data-x="dom-window-postMessage">postMessage()</code>
106235
106232
executes?</p>
106236
106233
106237
106234
<p>It should be that of <code data-x="">window</code>, to capture the intuitive notion that the
@@ -106281,15 +106278,15 @@ new PaymentRequest(…); // Allowed to use
106281
106278
<p>This time, the result involves more complicated mechanisms:</p>
106282
106279
106283
106280
<p>When <code data-x="">bound</code> is <span data-x="concept-idl-convert">converted</span> to a
106284
- Web IDL callback type, the <span>incumbent settings object </span> is that corresponding to <code
106285
- data-x="">window</code> (in the same manner as in our starter example above). Web IDL stores this
106286
- as the resulting callback value's <span>callback context</span>.</p>
106281
+ Web IDL callback type, the <span data-x="concept-incumbent-realm" >incumbent realm </span> is that
106282
+ corresponding to <code data-x="">window</code> (in the same manner as in our starter example
106283
+ above). Web IDL stores this as the resulting callback value's <span>callback context</span>.</p>
106287
106284
106288
106285
<p>When the <span data-x="concept-task">task</span> posted by <code
106289
106286
data-x="dom-setTimeout">setTimeout()</code> executes, the algorithm for that task uses Web IDL to
106290
106287
<span data-x="es-invoking-callback-functions">invoke</span> the stored callback value. Web IDL in
106291
106288
turn calls the above <span>prepare to run a callback</span> algorithm. This pushes the stored
106292
- <span>callback context</span> onto the <span>backup incumbent settings object stack</span>. At
106289
+ <span>callback context</span> onto the <span>backup incumbent realm stack</span>. At
106293
106290
this time (inside the timer task) there is no author code on the stack, so the <span>topmost
106294
106291
script-having execution context</span> is null, and nothing gets its
106295
106292
<span>skip-when-determining-incumbent counter</span> incremented.</p>
@@ -106304,11 +106301,12 @@ new PaymentRequest(…); // Allowed to use
106304
106301
data-x="dom-window-postMessage">postMessage()</code>, with no <span
106305
106302
data-x="js-ScriptEvaluation">ScriptEvaluation</span> context or similar below it.</p>
106306
106303
106307
- <p>This is where we fall back to the <span>backup incumbent settings object stack</span>. As
106308
- noted above, it will contain as its topmost entry the <span>relevant settings object</span> of
106309
- <code data-x="">window</code>. So that is what is used as the <span>incumbent settings
106310
- object</span> while executing the <code data-x="dom-window-postMessage">postMessage()</code>
106311
- algorithm.</p>
106304
+ <p>This is where we fall back to the <span>backup incumbent realm stack</span>.
106305
+ As noted above, it will contain as its topmost entry the <span
106306
+ data-x="concept-relevant-realm">relevant realm</span> of <code data-x="">window</code>.
106307
+ So its <span data-x="concept-realm-settings-object">settings object</span> is what is used as the
106308
+ <span>incumbent settings object</span> while executing the <code
106309
+ data-x="dom-window-postMessage">postMessage()</code> algorithm.</p>
106312
106310
</div>
106313
106311
106314
106312
<div class="example" id="example-incumbent-3">
@@ -106333,21 +106331,21 @@ document.querySelector("button").addEventListener("click", bound);
106333
106331
};
106334
106332
</script></code></pre>
106335
106333
106336
- <p>Again there are two interesting <span data-x="environment settings object">environment
106337
- settings objects</span> in play: that of < code data-x="">a.html</code>, and that of <code
106338
- data-x="">b.html</code>. When the <code data-x="dom-location-assign">location.assign()</code>
106339
- method triggers the <span><code>Location</code>-object navigate</span> algorithm, what will be
106340
- the <span >incumbent settings object </span>? As before, it should intuitively be that of <code
106341
- data-x="">a.html</code>: the <code data-x="event-click">click</code> listener was originally
106342
- scheduled by <code data-x="">a.html </code>, so even if something involving <code
106343
- data-x="">b .html</code> causes the listener to fire, the <span
106344
- data-x="concept-incumbent-everything">incumbent</span> responsible is that of <code
106345
- data-x="">a.html</code>.</p>
106334
+ <p>Again there are two interesting <span data-x="realm">realms</span> in play: that of
106335
+ < code data-x="">a.html</code>, and that of <code data-x="">b.html</code>.
106336
+ When the <code data-x="dom-location-assign">location.assign()</code> method triggers the
106337
+ <span><code>Location</code>-object navigate</span> algorithm, what will be the <span
106338
+ data-x="concept-incumbent-realm" >incumbent realm </span>?
106339
+ As before, it should intuitively be that of <code data-x="">a.html</code>: the <code
106340
+ data-x="event-click">click </code> listener was originally scheduled by <code
106341
+ data-x="">a .html</code>, so even if something involving <code data-x="">b.html</code> causes the
106342
+ listener to fire, the <span data-x="concept-incumbent-everything">incumbent</span> responsible is
106343
+ that of <code data-x="">a.html</code>.</p>
106346
106344
106347
106345
<p>The callback setup is similar to the previous example: when <code data-x="">bound</code> is
106348
- <span data-x="concept-idl-convert">converted</span> to a Web IDL callback type, the
106349
- <span >incumbent settings object </span> is that corresponding to <code data-x="">a.html</code>,
106350
- which is stored as the callback's <span>callback context</span>.</p>
106346
+ <span data-x="concept-idl-convert">converted</span> to a Web IDL callback type, the <span
106347
+ data-x="concept-incumbent-realm" >incumbent realm </span> is that corresponding to <code
106348
+ data-x="">a.html</code>, which is stored as the callback's <span>callback context</span>.</p>
106351
106349
106352
106350
<p>When the <code data-x="dom-click">click()</code> method is called inside <code
106353
106351
data-x="">b.html</code>, it <span data-x="concept-event-dispatch">dispatches</span> a <code
@@ -106356,17 +106354,16 @@ document.querySelector("button").addEventListener("click", bound);
106356
106354
executes as part of event dispatch, there <em>is</em> author code on the stack; the <span>topmost
106357
106355
script-having execution context</span> is that of the <code data-x="">onLoad</code> function,
106358
106356
whose <span>skip-when-determining-incumbent counter</span> gets incremented. Additionally, <code
106359
- data-x="">a.html</code>'s <span>environment settings object</span> (stored as the
106360
- <code>EventHandler</code>'s <span>callback context</span>) is pushed onto the
106361
- <span>backup incumbent settings object stack</span>.</p>
106357
+ data-x="">a.html</code>'s <span>realm</span> (stored as the <code>EventHandler</code>'s
106358
+ <span>callback context</span>) is pushed onto the <span>backup incumbent realm stack</span>.</p>
106362
106359
106363
106360
<p>Now, when the <span><code>Location</code>-object navigate</span> algorithm looks up the
106364
- <span>incumbent settings object</span>, the <span>topmost script-having execution
106365
- context</span> is still that of the <code data-x="">onLoad</code> function (due to the fact we
106366
- are using a bound function as the callback). Its <span>skip-when-determining-incumbent
106367
- counter</span> value is one, however, so we fall back to the <span>backup incumbent settings
106368
- object stack</span>. This gives us the <span>environment settings object </span> of <code
106369
- data-x="">a.html</code>, as expected.</p>
106361
+ <span data-x="concept-incumbent-global" >incumbent global object</span>, the <span>topmost
106362
+ script-having execution context</span> is still that of the <code data-x="">onLoad</code>
106363
+ function (due to the fact we are using a bound function as the callback).
106364
+ Its <span>skip-when-determining-incumbent counter</span> value is one, however, so we fall back
106365
+ to the <span>backup incumbent realm stack </span>.
106366
+ This gives us the <span>realm</span> of <code data-x="">a.html</code>, as expected.</p>
106370
106367
106371
106368
<p>Note that this means that even though it is the <code>iframe</code> inside <code
106372
106369
data-x="">a.html</code> that navigates, it is <code data-x="">a.html</code> itself that is used
@@ -109569,14 +109566,14 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
109569
109566
<ref>JAVASCRIPT</ref></p>
109570
109567
109571
109568
<ol>
109572
- <li><p>Let <var>incumbent settings </var> be
109573
- <var>callback</var>.[[HostDefined]].[[IncumbentSettings ]].</p></li>
109569
+ <li><p>Let <var>incumbent realm </var> be
109570
+ <var>callback</var>.[[HostDefined]].[[IncumbentRealm ]].</p></li>
109574
109571
109575
109572
<li><p>Let <var>script execution context</var> be
109576
109573
<var>callback</var>.[[HostDefined]].[[ActiveScriptContext]].</li>
109577
109574
109578
109575
<li>
109579
- <p><span>Prepare to run a callback</span> with <var>incumbent settings </var>.</p>
109576
+ <p><span>Prepare to run a callback</span> with <var>incumbent realm </var>.</p>
109580
109577
109581
109578
<p class="note">This affects the <span data-x="concept-incumbent-everything">incumbent</span>
109582
109579
concept while the callback runs.</p>
@@ -109597,8 +109594,7 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
109597
109594
pop">pop</span> <var>script execution context</var> from the <span>JavaScript execution context
109598
109595
stack</span>.</p></li>
109599
109596
109600
- <li><p><span>Clean up after running a callback</span> with <var>incumbent
109601
- settings</var>.</p></li>
109597
+ <li><p><span>Clean up after running a callback</span> with <var>incumbent realm</var>.</p></li>
109602
109598
109603
109599
<li><p>Return <var>result</var>.</p></li>
109604
109600
</ol>
@@ -109788,7 +109784,8 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
109788
109784
<ref>JAVASCRIPT</ref></p>
109789
109785
109790
109786
<ol>
109791
- <li><p>Let <var>incumbent settings</var> be the <span>incumbent settings object</span>.</p></li>
109787
+ <li><p>Let <var>incumbent realm</var> be the <span data-x="concept-incumbent-realm">incumbent
109788
+ realm</span>.</p></li>
109792
109789
109793
109790
<li><p>Let <var>active script</var> be the <span>active script</span>.</p></li>
109794
109791
@@ -109841,7 +109838,7 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
109841
109838
</li>
109842
109839
109843
109840
<li><p>Return the <span>JobCallback Record</span> { [[Callback]]: <var>callable</var>,
109844
- [[HostDefined]]: { [[IncumbentSettings ]]: <var>incumbent settings </var>, [[ActiveScriptContext]]:
109841
+ [[HostDefined]]: { [[IncumbentRealm ]]: <var>incumbent realm </var>, [[ActiveScriptContext]]:
109845
109842
<var>script execution context</var> } }.</p></li>
109846
109843
</ol>
109847
109844
0 commit comments