diff --git a/source b/source index 760de2984fc..fc32f30a920 100644 --- a/source +++ b/source @@ -3080,6 +3080,16 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute + +

User agents that support JavaScript must also implement the AsyncContext + proposal. The following terms are defined there, and used in this specification: + JSASYNCCONTEXT

+ +
WebAssembly
@@ -105767,19 +105777,28 @@ dictionary ErrorEventInit : EventInit { global to run the following substep:

    -
  1. For each promise p in list:

    +
  2. For each tuple element in list:

      +
    1. Let p be element[0]. +

    2. If p's [[PromiseIsHandled]] internal slot is true, continue to the next iteration of the loop.

    3. +
    4. Let previousContextMapping be AsyncContextSwap(element[1]).

    5. +
    6. Let notHandled be the result of firing an event named unhandledrejection at global, using PromiseRejectionEvent, with the cancelable attribute initialized to true, the promise attribute initialized to p, and the reason attribute - initialized to the value of p's [[PromiseResult]] internal slot.

    7. + initialized to the value of p's [[PromiseResult]] internal slot, with + useCallerAsyncContextFlag set.

      + +
    8. Perform AsyncContextSwap(previousContextMapping).

    9. If notHandled is false, then the promise rejection is handled. Otherwise, the promise rejection is @@ -106706,8 +106725,11 @@ dictionary PromiseRejectionEventInit : EventInitIf operation is "reject", then:

        -
      1. Append promise to settings - object's about-to-be-notified rejected promises list.

      2. +
      3. Let snapshot be AsyncContextSnapshot().

      4. + +
      5. Append (promise, snapshot) to + settings object's about-to-be-notified rejected promises list.

    10. @@ -106716,8 +106738,9 @@ dictionary PromiseRejectionEventInit : EventInit
    11. If settings object's about-to-be-notified rejected promises - list contains promise, then remove promise from that list and return.

    12. + list
      contains an element element for + which element[0] is promise, then remove element from that list and return.

    13. If settings object's outstanding rejected promises weak set does not contain promise, then return.

    14. @@ -106734,7 +106757,8 @@ dictionary PromiseRejectionEventInit : EventInitPromiseRejectionEvent, with the promise attribute initialized to promise, and the reason - attribute initialized to promise.[[PromiseResult]].

      + attribute initialized to promise.[[PromiseResult]], and useCallerAsyncContextFlag + set.

@@ -106783,9 +106807,16 @@ dictionary PromiseRejectionEventInit : EventInitThis affects the active script while the callback runs.

+
  • Let previousContextMapping be AsyncContextSwap(callback.[[AsyncContextSnapshot]]).

  • +
  • Let result be Call(callback.[[Callback]], V, argumentsList).

  • +
  • Perform AsyncContextSwap(previousContextMapping).

  • +
  • If script execution context is not null, then pop script execution context from the JavaScript execution context stack.

  • @@ -107019,7 +107050,11 @@ dictionary PromiseRejectionEventInit : EventInit +
  • Let snapshot be AsyncContextSnapshot().

  • +
  • Return the JobCallback Record { [[Callback]]: callable, + [[AsyncContextSnapshot]]: snapshot, [[HostDefined]]: { [[IncumbentSettings]]: incumbent settings, [[ActiveScriptContext]]: script execution context } }.

  • @@ -108884,7 +108919,8 @@ import "https://example.com/foo/../module2.mjs"; steps.

  • Set eventHandler's value to the - internal raw uncompiled handler value/location.

  • + internal raw uncompiled handler (value, location, + AsyncContextSnapshot()).

  • Activate an event handler given eventTarget and localName.

  • @@ -109227,6 +109263,8 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnl
  • A location where the script body originated, in case an error needs to be reported +
  • A list of Async Context Mapping + Records

    When the user agent is to get the @@ -109241,9 +109279,11 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnl

  • Let eventHandler be handlerMap[name].

  • +
  • Let value be eventHandler's + value.

  • +
  • -

    If eventHandler's value is an - internal raw uncompiled handler, then:

    +

    If value is an internal raw uncompiled handler, then:

    1. If eventTarget is an element, then let element be @@ -109255,11 +109295,9 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnl

    2. If scripting is disabled for document, then return null.

    3. -
    4. Let body be the uncompiled script body in eventHandler's value.

    5. +
    6. Let body be value[0].

    7. -
    8. Let location be the location where the script body originated, as - given by eventHandler's value.

    9. +
    10. Let location be value[1].

    11. If element is not null and element has a form owner, let form owner be that form owner. @@ -109414,10 +109452,13 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnl

    12. +
    13. Let context be the tuple (settings object, + value[2]).

    14. +
    15. Set eventHandler's value to the result of creating a Web IDL EventHandler callback function object whose object - reference is function and whose callback context is settings - object.

    16. + reference is function and whose callback context is + context.

  • @@ -110668,6 +110709,9 @@ partial interface ShadowRoot { object; otherwise let thisArg be the WindowProxy that corresponds to global.

    +
  • Let snapshot be AsyncContextSnapshot().

  • +
  • If previousId was given, let id be previousId; otherwise, let id be an implementation-defined integer that is greater than zero and does not already exist in global's @@ -110704,6 +110748,10 @@ partial interface ShadowRoot {

  • If id does not exist in global's map of active timers, then abort these steps.

  • +
  • Let previousContextMapping be AsyncContextSwap(callback.[[AsyncContextSnapshot]]).

  • +
  • If handler is a Function, then invoke handler given arguments with the callback this @@ -110718,8 +110766,8 @@ partial interface ShadowRoot {

  • Perform HostEnsureCanCompileStrings(realm). - If this throws an exception, catch it, report the exception, and abort these - steps.

  • + If this throws an exception, catch it, report the exception, and jump to the + step labeled return.

  • Let settings object be global's relevant settings object.

  • @@ -110773,7 +110821,7 @@ partial interface ShadowRoot {
  • If id does not exist in global's - map of active timers, then abort these steps.

    + map of active timers, then jump to the step labeled return.

    It might have been removed via the author code in handler calling clearTimeout() or ShadowRoot {

  • Otherwise, remove global's map of active timers[id].

  • + +
  • Return: Perform AsyncContextSwap(previousContextMapping).

  • @@ -114275,6 +114326,9 @@ function receiver(e) { StructuredSerializeWithTransfer(message, transfer). Rethrow any exceptions.

    +
  • Let snapshot be AsyncContextSnapshot().

  • +
  • Queue a global task on the posted message task source given targetWindow to run the following steps:

    @@ -114285,6 +114339,9 @@ function receiver(e) { Document's origin is not same origin with targetOrigin, then return.

  • +
  • Let previousContextMapping be AsyncContextSwap(snapshot).

  • +
  • Let origin be the serialization of incumbentSettings's origin.

  • @@ -114303,7 +114360,7 @@ function receiver(e) { targetWindow, using MessageEvent, with the origin attribute initialized to origin and the source attribute initialized to - source, and then return.

    + source, and then jump to the step below labeled return.

  • Let messageClone be deserializeRecord.[[Deserialized]].

  • @@ -114318,8 +114375,11 @@ function receiver(e) { attribute initialized to origin, the source attribute initialized to source, the data attribute initialized to - messageClone, and the ports attribute - initialized to newPorts.

    + messageClone, the ports attribute + initialized to newPorts, and useCallerAsyncContextFlag flag set.

    + +
  • Return: Perform AsyncContextSwap(previousContextMapping).

  • @@ -114775,6 +114835,9 @@ dictionary StructuredSerializeOptions { algorithm runs scripts). We don't throw an exception for 'doomed' being true, because this can't necessarily be detected right now every time --> +
  • Let snapshot be AsyncContextSnapshot().

  • +
  • Add a task that runs the following steps to the port message queue of targetPort:

    @@ -114791,6 +114854,9 @@ dictionary StructuredSerializeOptions {
  • Let targetRealm be finalTargetPort's relevant realm.

  • +
  • Let previousContextMapping be AsyncContextSwap(snapshot).

  • +
  • Let deserializeRecord be StructuredDeserializeWithTransfer(serializeWithTransferResult, @@ -114798,7 +114864,8 @@ dictionary StructuredSerializeOptions {

    If this throws an exception, catch it, fire an event named messageerror at - finalTargetPort, using MessageEvent, and then return. + finalTargetPort, using MessageEvent, and then jump to the step below + labeled return.

  • Let messageClone be deserializeRecord.[[Deserialized]].

  • @@ -114810,9 +114877,12 @@ dictionary StructuredSerializeOptions {
  • Fire an event named message at finalTargetPort, using MessageEvent, with the data attribute - initialized to messageClone and the messageClone, the ports attribute initialized to - newPorts.

  • + newPorts, and useCallerAsyncContextFlag flag set.

    + +
  • Return: Perform AsyncContextSwap(previousContextMapping).

  • @@ -140070,6 +140140,9 @@ INSERT INTERFACES HERE
    [JPEG]
    JPEG File Interchange Format, E. Hamilton.
    +
    [JSASYNCCONTEXT]
    +
    AsyncContext. Ecma International.
    +
    [JSERRORSTACKS]
    (Non-normative) Error Stacks. Ecma International.