Skip to content

Commit e7ea06b

Browse files
committed
Add support for AsyncContext in dispatching Events
1 parent ca756e0 commit e7ea06b

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

dom.bs

+29-17
Original file line numberDiff line numberDiff line change
@@ -1270,8 +1270,9 @@ property of the event being dispatched.
12701270
<h3 id=dispatching-events>Dispatching events</h3>
12711271

12721272
<p>To <dfn export id=concept-event-dispatch>dispatch</dfn> an <var>event</var> to a
1273-
<var>target</var>, with an optional <var>legacy target override flag</var> and an optional
1274-
<var>legacyOutputDidListenersThrowFlag</var>, run these steps:
1273+
<var>target</var>, with an optional <var>legacy target override flag</var>, an optional
1274+
<var>legacyOutputDidListenersThrowFlag</var>, and an optional
1275+
<var>useCallerAsyncContextFlag</var>, run these steps:
12751276

12761277
<ol>
12771278
<li><p>Set <var>event</var>'s <a>dispatch flag</a>.
@@ -1408,8 +1409,9 @@ property of the event being dispatched.
14081409
<li><p>Otherwise, set <var>event</var>'s {{Event/eventPhase}} attribute to
14091410
{{Event/CAPTURING_PHASE}}.
14101411

1411-
<li><p><a>Invoke</a> with <var>struct</var>, <var>event</var>, "<code>capturing</code>", and
1412-
<var>legacyOutputDidListenersThrowFlag</var> if given.
1412+
<li><p><a>Invoke</a> with <var>struct</var>, <var>event</var>, "<code>capturing</code>",
1413+
<var>legacyOutputDidListenersThrowFlag</var> if given, and
1414+
<var>useCallerAsyncContextFlag</var> if given.
14131415
</ol>
14141416

14151417
<li>
@@ -1429,8 +1431,9 @@ property of the event being dispatched.
14291431
<li><p>Set <var>event</var>'s {{Event/eventPhase}} attribute to {{Event/BUBBLING_PHASE}}.
14301432
</ol>
14311433

1432-
<li><p><a>Invoke</a> with <var>struct</var>, <var>event</var>, "<code>bubbling</code>", and
1433-
<var>legacyOutputDidListenersThrowFlag</var> if given.
1434+
<li><p><a>Invoke</a> with <var>struct</var>, <var>event</var>, "<code>bubbling</code>",
1435+
<var>legacyOutputDidListenersThrowFlag</var> if given, and
1436+
<var>useCallerAsyncContextFlag</var> if given.
14341437
</ol>
14351438
</ol>
14361439

@@ -1496,8 +1499,9 @@ steps:</p>
14961499
</ol>
14971500

14981501
<p>To <dfn noexport id=concept-event-listener-invoke>invoke</dfn>, given a <var>struct</var>,
1499-
<var>event</var>, <var>phase</var>, and an optional <var>legacyOutputDidListenersThrowFlag</var>,
1500-
run these steps:
1502+
<var>event</var>, <var>phase</var>, an optional <var>legacyOutputDidListenersThrowFlag</var>,
1503+
an optional <var>legacyOutputDidListenersThrowFlag</var> if given, and an optional
1504+
<var>useCallerAsyncContextFlag</var>, run these steps:
15011505

15021506
<ol>
15031507
<li><p>Set <var>event</var>'s <a for=Event>target</a> to the
@@ -1527,8 +1531,9 @@ run these steps:
15271531
<a for=Event/path>invocation-target-in-shadow-tree</a>.
15281532

15291533
<li><p>Let <var>found</var> be the result of running <a>inner invoke</a> with <var>event</var>,
1530-
<var>listeners</var>, <var>phase</var>, <var>invocationTargetInShadowTree</var>, and
1531-
<var>legacyOutputDidListenersThrowFlag</var> if given.
1534+
<var>listeners</var>, <var>phase</var>, <var>invocationTargetInShadowTree</var>,
1535+
<var>legacyOutputDidListenersThrowFlag</var> if given, and <var>useCallerAsyncContextFlag</var> if
1536+
given.
15321537

15331538
<li>
15341539
<p>If <var>found</var> is false and <var>event</var>'s {{Event/isTrusted}} attribute is true,
@@ -1553,20 +1558,24 @@ run these steps:
15531558
</table>
15541559

15551560
<li><p><a>Inner invoke</a> with <var>event</var>, <var>listeners</var>, <var>phase</var>,
1556-
<var>invocationTargetInShadowTree</var>, and <var>legacyOutputDidListenersThrowFlag</var>
1557-
if given.
1561+
<var>invocationTargetInShadowTree</var>, <var>legacyOutputDidListenersThrowFlag</var> if given,
1562+
and <var>useCallerAsyncContextFlag</var> if given.
15581563

15591564
<li><p>Set <var>event</var>'s {{Event/type}} attribute value to <var>originalEventType</var>.
15601565
</ol>
15611566
</ol>
15621567

15631568
<p>To <dfn noexport id=concept-event-listener-inner-invoke>inner invoke</dfn>, given an
15641569
<var>event</var>, <var>listeners</var>, <var>phase</var>, <var>invocationTargetInShadowTree</var>,
1565-
and an optional <var>legacyOutputDidListenersThrowFlag</var>, run these steps:
1570+
and an optional <var>legacyOutputDidListenersThrowFlag</var>, and an optional
1571+
<var>useCallerAsyncContextFlag</var>, run these steps:
15661572

15671573
<ol>
15681574
<li><p>Let <var>found</var> be false.
15691575

1576+
<li><p>Let <var>useCreationTimeAsyncContext</var> be false if
1577+
<var>useCallerAsyncContextFlag</var> is passed and true otherwise.
1578+
15701579
<li>
15711580
<p><a for=list>For each</a> <var>listener</var> in <var>listeners</var>, whose
15721581
<a for="event listener">removed</a> is false:
@@ -1609,8 +1618,9 @@ and an optional <var>legacyOutputDidListenersThrowFlag</var>, run these steps:
16091618

16101619
<li>
16111620
<p><a>Call a user object's operation</a> with <var>listener</var>'s
1612-
<a for="event listener">callback</a>, "<code>handleEvent</code>", « <var>event</var> », and
1613-
<var>event</var>'s {{Event/currentTarget}} attribute value. If this throws an exception, then:
1621+
<a for="event listener">callback</a>, "<code>handleEvent</code>", « <var>event</var> »,
1622+
<var>event</var>'s {{Event/currentTarget}} attribute value, and
1623+
<var>useCreationTimeAsyncContext</var>. If this throws an exception, then:
16141624

16151625
<ol>
16161626
<li><p><a>Report the exception</a>.
@@ -1639,7 +1649,8 @@ and an optional <var>legacyOutputDidListenersThrowFlag</var>, run these steps:
16391649

16401650
<p>To <dfn export id=concept-event-fire>fire an event</dfn> named <var>e</var> at <var>target</var>,
16411651
optionally using an <var>eventConstructor</var>, with a description of how IDL attributes are to be
1642-
initialized, and a <var>legacy target override flag</var>, run these steps:
1652+
initialized, a <var>legacy target override flag</var>, and an optional
1653+
<var>useCallerAsyncContextFlag</var> run these steps:
16431654

16441655
<ol>
16451656
<li><p>If <var>eventConstructor</var> is not given, then let <var>eventConstructor</var> be
@@ -1657,7 +1668,8 @@ initialized, and a <var>legacy target override flag</var>, run these steps:
16571668
<p class=note>This also allows for the {{Event/isTrusted}} attribute to be set to false.
16581669

16591670
<li><p>Return the result of <a>dispatching</a> <var>event</var> at <var>target</var>, with
1660-
<var>legacy target override flag</var> set if set.
1671+
<var>legacy target override flag</var> set if set, and <var>useCallerAsyncContextFlag</var> set if
1672+
set.
16611673
</ol>
16621674

16631675
<p class=note>Fire in the context of DOM is short for

0 commit comments

Comments
 (0)