From 2e17139255462e26318145d6ec4cfedd4e611b7a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 12 Dec 2023 15:10:21 +0100 Subject: [PATCH] Add support for AsyncContext in dispatching Events --- dom.bs | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/dom.bs b/dom.bs index b583aeb3..3ed0c2e0 100644 --- a/dom.bs +++ b/dom.bs @@ -1287,8 +1287,9 @@ property of the event being dispatched.

To dispatch an event to a -target, with an optional legacy target override flag and an optional -legacyOutputDidListenersThrowFlag, run these steps: +target, with an optional legacy target override flag, an optional +legacyOutputDidListenersThrowFlag, and an optional +useCallerAsyncContextFlag, run these steps:

  1. Set event's dispatch flag. @@ -1425,8 +1426,9 @@ property of the event being dispatched.

  2. Otherwise, set event's {{Event/eventPhase}} attribute to {{Event/CAPTURING_PHASE}}. -

  3. Invoke with struct, event, "capturing", and - legacyOutputDidListenersThrowFlag if given. +

  4. Invoke with struct, event, "capturing", + legacyOutputDidListenersThrowFlag if given, and + useCallerAsyncContextFlag if given.

  • @@ -1446,8 +1448,9 @@ property of the event being dispatched.
  • Set event's {{Event/eventPhase}} attribute to {{Event/BUBBLING_PHASE}}. -

  • Invoke with struct, event, "bubbling", and - legacyOutputDidListenersThrowFlag if given. +

  • Invoke with struct, event, "bubbling", + legacyOutputDidListenersThrowFlag if given, and + useCallerAsyncContextFlag if given. @@ -1517,8 +1520,9 @@ steps:

    To invoke, given a struct, -event, phase, and an optional legacyOutputDidListenersThrowFlag, -run these steps: +event, phase, an optional legacyOutputDidListenersThrowFlag, +an optional legacyOutputDidListenersThrowFlag if given, and an optional +useCallerAsyncContextFlag, run these steps:

    1. Set event's target to the @@ -1548,8 +1552,9 @@ run these steps: invocation-target-in-shadow-tree.

    2. Let found be the result of running inner invoke with event, - listeners, phase, invocationTargetInShadowTree, and - legacyOutputDidListenersThrowFlag if given. + listeners, phase, invocationTargetInShadowTree, + legacyOutputDidListenersThrowFlag if given, and useCallerAsyncContextFlag if + given.

    3. If found is false and event's {{Event/isTrusted}} attribute is true, @@ -1574,8 +1579,8 @@ run these steps:

    4. Inner invoke with event, listeners, phase, - invocationTargetInShadowTree, and legacyOutputDidListenersThrowFlag - if given. + invocationTargetInShadowTree, legacyOutputDidListenersThrowFlag if given, + and useCallerAsyncContextFlag if given.

    5. Set event's {{Event/type}} attribute value to originalEventType.

    @@ -1585,11 +1590,15 @@ run these steps:

    To inner invoke, given an event, listeners, phase, invocationTargetInShadowTree, -and an optional legacyOutputDidListenersThrowFlag, run these steps: +and an optional legacyOutputDidListenersThrowFlag, and an optional +useCallerAsyncContextFlag, run these steps:

    1. Let found be false. +

    2. Let useCreationTimeAsyncContext be false if + useCallerAsyncContextFlag is passed and true otherwise. +

    3. For each listener in listeners, whose removed is false: @@ -1632,8 +1641,9 @@ and an optional legacyOutputDidListenersThrowFlag, run these steps:

    4. Call a user object's operation with listener's - callback, "handleEvent", « event », and - event's {{Event/currentTarget}} attribute value. If this throws an exception, then: + callback, "handleEvent", « event », + event's {{Event/currentTarget}} attribute value, and + useCreationTimeAsyncContext. If this throws an exception, then:

      1. Report the exception. @@ -1664,7 +1674,8 @@ and an optional legacyOutputDidListenersThrowFlag, run these steps:

        To fire an event named e at target, optionally using an eventConstructor, with a description of how IDL attributes are to be -initialized, and a legacy target override flag, run these steps: +initialized, a legacy target override flag, and an optional +useCallerAsyncContextFlag run these steps:

        1. If eventConstructor is not given, then let eventConstructor be @@ -1682,7 +1693,8 @@ initialized, and a legacy target override flag, run these steps:

          This also allows for the {{Event/isTrusted}} attribute to be set to false.

        2. Return the result of dispatching event at target, with - legacy target override flag set if set. + legacy target override flag set if set, and useCallerAsyncContextFlag set if + set.