Skip to content

Commit edf19e2

Browse files
authored
Fix object providence in event loops
Closes #4337, by being much clearer about how browsing contexts, Documents, and Windows documents are selected for each turn of the event loop processing model. This also fixes an issue where the "report the duration of the update the rendering step" referenced the out-of-scope variable "docs".
1 parent f87a58c commit edf19e2

File tree

1 file changed

+48
-44
lines changed

1 file changed

+48
-44
lines changed

source

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -89211,6 +89211,8 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8921189211

8921289212
<li><p><i>Microtasks</i>: <span>Perform a microtask checkpoint</span>.</p></li>
8921389213

89214+
<li><p>Let <var>hasARenderingOpportunity</var> be false.</p></li>
89215+
8921489216
<li><p>Let <var>now</var> be the <span>current high resolution time</span>. <ref
8921589217
spec=HRT></p></li>
8921689218

@@ -89238,9 +89240,9 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8923889240

8923989241
<ol>
8924089242
<li>
89241-
<p>Let <var>docs</var> be the list of <code>Document</code> objects associated with the
89242-
<span>event loop</span> in question, sorted arbitrarily except that the following conditions
89243-
must be met:</p>
89243+
<p>Let <var>docs</var> be all <code>Document</code> objects whose <span>relevant
89244+
agent</span>'s <span>event loop</span> is this event loop, sorted arbitrarily except that the
89245+
following conditions must be met:</p>
8924489246

8924589247
<ul>
8924689248
<li><p>Any <code>Document</code> <var>B</var> whose <span
@@ -89262,11 +89264,9 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8926289264
</li>
8926389265

8926489266
<li>
89265-
<p><i>Rendering opportunites</i>: If there are <span data-x="browsing context">browsing
89266-
contexts</span> <var>browsingContexts</var> that do not have a <span>rendering
89267-
opportunity</span>, then remove from <var>docs</var> all <code>Document</code> objects whose
89268-
<span data-x="concept-document-bc">browsing context</span> is in
89269-
<var>browsingContexts</var>.</p>
89267+
<p><i>Rendering opportunities</i>: Remove from <var>docs</var> all <code>Document</code>
89268+
objects whose <span data-x="concept-document-bc">browsing context</span> do not have a
89269+
<span>rendering opportunity</span>.</p>
8927089270

8927189271
<p>A <span>browsing context</span> has a <dfn>rendering opportunity</dfn> if the user agent is
8927289272
currently able to present the contents of the <span>browsing context</span> to the user,
@@ -89288,19 +89288,23 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8928889288
a much slower 4 rendering opportunities per second, or even less.</p>
8928989289
</li>
8929089290

89291-
<li><p><i>Unnecessary rendering</i>: If there are <span data-x="browsing context">browsing
89292-
contexts</span> <var>browsingContexts</var> for which the user agent believes updating the
89293-
rendering would have no visible effect and which possess no <code>Document</code> objects with
89294-
a non-empty <span>map of animation frame callbacks</span>, then remove from <var>docs</var>
89295-
all <code>Document</code> objects whose <span data-x="concept-document-bc">browsing
89296-
context</span> is in <var>browsingContexts</var>.</p></li>
89291+
<li><p>If <var>docs</var> is not empty, then set <var>hasARenderingOpportunity</var> to
89292+
true.</p></li>
8929789293

8929889294
<li>
89299-
<p>If there are <span data-x="browsing context">browsing contexts</span>
89300-
<var>browsingContexts</var> for which the user agent believes it's preferrable to skip
89301-
updating the rendering for other reasons, then remove from <var>docs</var> all
89302-
<code>Document</code> objects whose <span data-x="concept-document-bc">browsing context</span>
89303-
is in <var>browsingContexts</var>.</p>
89295+
<p><i>Unnecessary rendering</i>: Remove from <var>docs</var> all <code>Document</code> objects
89296+
which meet both of the following conditions:</p>
89297+
89298+
<ul class="brief">
89299+
<li>The user agent believes that updating the rendering of the <code>Document</code>'s <span
89300+
data-x="concept-document-bc">browsing context</span> would have no visible effect, and</li>
89301+
<li>The <code>Document</code>'s <span>map of animation frame callbacks</span> is empty.</li>
89302+
</ul>
89303+
</li>
89304+
89305+
<li>
89306+
<p>Remove from <var>docs</var> all <code>Document</code> objects for which the user agent
89307+
believes that it's preferrable to skip updating the rendering for other reasons.</p>
8930489308

8930589309
<div class="note">
8930689310
<p>The step labeled <i>Rendering opportunities</i> prevents the user agent from updating the
@@ -89359,6 +89363,25 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8935989363
<li><p>For each <span>fully active</span> <code>Document</code> in <var>docs</var>, update the
8936089364
rendering or user interface of that <code>Document</code> and its <span
8936189365
data-x="concept-document-bc">browsing context</span> to reflect the current state.</p></li>
89366+
89367+
<li>
89368+
<p>Report the duration of the <span>update the rendering</span> step by performing the
89369+
following steps:</p>
89370+
89371+
<ol>
89372+
<li><p>Let <var>rendering end time</var> be the <span>current high resolution
89373+
time</span>.</p></li>
89374+
89375+
<li><p>Let <var>top-level browsing contexts</var> be the set of all <span data-x="top-level
89376+
browsing context">top-level browsing contexts</span> of the <span
89377+
data-x="concept-document-bc">browsing contexts</span> of all <span>fully active</span>
89378+
<code>Document</code>s in <var>docs</var>.</p></li>
89379+
89380+
<li><p><span>Report long tasks</span>, passing in <var>now</var> (repurposed as meaning the
89381+
beginning of the <span>update the rendering</span> step), <var>rendering end time</var>, and
89382+
<var>top-level browsing contexts</var>.</p></li>
89383+
</ol>
89384+
</li>
8936289385
</ol>
8936389386
</li>
8936489387

@@ -89367,36 +89390,17 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8936789390

8936889391
<ul class="brief">
8936989392
<li>this is a <span>window event loop</span></li>
89370-
<li>there is no <span data-x="concept-task">task</span> in the <span>event loop</span>'s
89393+
<li>there is no <span data-x="concept-task">task</span> in this <span>event loop</span>'s
8937189394
<span data-x="task queue">task queues</span> whose <span
8937289395
data-x="concept-task-document">document</span> is <span>fully active</span></li>
89373-
<li>the <span>event loop</span>'s <span>microtask queue</span> is <span data-x="list is
89396+
<li>this <span>event loop</span>'s <span>microtask queue</span> is <span data-x="list is
8937489397
empty">empty</span></li>
89375-
<li>none of the <span data-x="browsing context">browsing contexts</span> have a
89376-
<span>rendering opportunity</span></li>
89398+
<li><var>hasARenderingOpportunity</var> is false</li>
8937789399
</ul>
8937889400

89379-
<p>then for each <span>browsing context</span>, run the steps in the <span>start an idle period
89380-
algorithm</span>, passing the <code>Window</code> associated with that <span>browsing
89381-
context</span>. <ref spec="REQUESTIDLECALLBACK"></p>
89382-
</li>
89383-
89384-
<li>
89385-
<p>Report the duration of the <span>update the rendering</span> step by performing the
89386-
following steps:</p>
89387-
89388-
<ol>
89389-
<li><p>Let <var>rendering end time</var> be the <span>current high resolution
89390-
time</span>.</p></li>
89391-
89392-
<li><p>Let <var>top-level browsing contexts</var> be the set of all <span data-x="top-level
89393-
browsing context">top-level browsing contexts</span> of all <span>fully active</span>
89394-
<code>Document</code>s in <var>docs</var>.</p></li>
89395-
89396-
<li><p><span>Report long tasks</span>, passing in <var>now</var> (repurposed as meaning the
89397-
beginning of the <span>update the rendering</span> step), <var>rendering end time</var>, and
89398-
<var>top-level browsing contexts</var>.</p></li>
89399-
</ol>
89401+
<p>then for each <code>Window</code> object whose whose <span>relevant agent</span>'s
89402+
<span>event loop</span> is this event loop, run the <span>start an idle period
89403+
algorithm</span>, passing the <code>Window</code>. <ref spec="REQUESTIDLECALLBACK"></p>
8940089404
</li>
8940189405

8940289406
<li>

0 commit comments

Comments
 (0)