diff --git a/source b/source index 17a6b7941e9..a55ca40e49e 100644 --- a/source +++ b/source @@ -8584,19 +8584,6 @@ o.myself = o; -

StructuredCloneWithTransfer ( value, - transferList, targetRealm )

- -
    -
  1. Let serializeWithTransferResult be ? - StructuredSerializeWithTransfer(value, transferList).

  2. - -
  3. Return ? - StructuredDeserializeWithTransfer(serializeWithTransferResult, - targetRealm).

  4. -
-

Performing serialization and transferring from other specifications

@@ -8604,15 +8591,6 @@ o.myself = o; some guidance on when each abstract operation is typically useful, with examples.

-
StructuredCloneWithTransfer
-
-

Cloning a value into a known target JavaScript Realm, with a transfer list.

- -

window.postMessage() uses - StructuredCloneWithTransfer to allow cloning and transferring values between - different globals.

-
-
StructuredSerializeWithTransfer
StructuredDeserializeWithTransfer
@@ -8664,18 +8642,17 @@ o.myself = o;

Call sites that are not invoked as a result of author code synchronously calling into a user agent method must take care to properly prepare to run script and prepare to - run a callback before invoking StructuredCloneWithTransfer, - StructuredSerialize, or StructuredSerializeWithTransfer abstract - operations, if they are being performed on arbitrary objects. This is necessary because the - serialization process can invoke author-defined accessors as part of its final deep-serialization - steps, and these accessors could call into operations that rely on the entry and before invoking StructuredSerialize or + StructuredSerializeWithTransfer abstract operations, if they are being performed on + arbitrary objects. This is necessary because the serialization process can invoke author-defined + accessors as part of its final deep-serialization steps, and these accessors could call into + operations that rely on the entry and incumbent concepts being properly set up.

window.postMessage() performs - StructuredCloneWithTransfer on its arguments, but is careful to do so immediately, - inside the synchronous portion of its algorithm. Thus it is able to use the structured cloning - algorithms without needing to prepare to run script and prepare to run a + StructuredSerialize on its arguments, but is careful to do so immediately, inside the + synchronous portion of its algorithm. Thus it is able to use the structured cloning algorithms + without needing to prepare to run script and prepare to run a callback.

In contrast, a hypothetical API that used StructuredSerialize to @@ -14922,6 +14899,7 @@ c-end = "-->"

onhashchange
onlanguagechange
onmessage
+
onmessageerror
onoffline
ononline
onpagehide
@@ -90021,6 +89999,7 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEvent onhashchange hashchange onlanguagechange languagechange onmessage message + onmessageerror messageerror onoffline offline ononline online onpagehide pagehide @@ -90145,6 +90124,7 @@ interface WindowEventHandlers { attribute EventHandler onhashchange; attribute EventHandler onlanguagechange; attribute EventHandler onmessage; + attribute EventHandler onmessageerror; attribute EventHandler onoffline; attribute EventHandler ononline; attribute EventHandler onpagehide; @@ -95634,37 +95614,57 @@ function receiver(e) { -
  • Let cloneRecord be StructuredCloneWithTransfer(message, - transfer, targetRealm). Rethrow any exceptions.

  • +
  • Let serializeWithTransferResult be + StructuredSerializeWithTransfer(message, transfer, + targetRealm). Rethrow any exceptions.

  • + +
  • +

    Queue a task on the posted message task source to run the + following steps:

    -
  • Let messageClone be cloneRecord.[[Deserialized]].

  • +
      +
    1. If the targetOrigin argument is not a single literal U+002A ASTERISK character + (*) and targetWindow's associated + Document's origin is not same origin with + targetOrigin, then abort these steps.

    2. + +
    3. Let origin be the Unicode + serialization of incumbentSettings's origin.

    4. -
    5. Let newPorts be a new frozen array consisting of all - MessagePort objects in cloneRecord.[[TransferredValues]], if any, - maintaining their relative order.

    6. +
    7. Let source be the WindowProxy object's corresponding to + incumbentSettings's global + object (a Window object).

    8. -
    9. Return, but continue running these steps in in parallel.

    10. +
    11. +

      Let deserializeRecord be + StructuredDeserializeWithTransfer(serializeWithTransferResult, + targetRealm).

      + +

      If this throws an exception, fire an event named + messageerror at targetWindow, using + MessageEvent, with the origin + attribute initialized to origin and the source attribute initialized to source, and + then abort these steps.

      +
    12. -
    13. If the targetOrigin argument is not a single literal U+002A ASTERISK character - (*) and targetWindow's associated - Document's origin is not same origin with - targetOrigin, then abort these steps.

    14. +
    15. Let messageClone be deserializeRecord.[[Deserialized]].

    16. -
    17. Queue a task on the posted message task source to fire an event named message at targetWindow, using - MessageEvent, with the data attribute - initialized to messageClone, the origin - attribute initialized to the Unicode - serialization of incumbentSettings's origin, the source attribute initialized to the - WindowProxy object's corresponding incumbentSettings's global object (a Window object), and - the ports attribute initialized to - newPorts.

    18. +
    19. Let newPorts be a new frozen array consisting of all + MessagePort objects in deserializeRecord.[[TransferredValues]], if any, + maintaining their relative order.

    20. +
    21. Fire an event named message at targetWindow, using + MessageEvent, with the origin + attribute initialized to origin, the source attribute initialized to source, the + data attribute initialized to + messageClone, and the ports attribute + initialized to newPorts.

    22. +
    + @@ -95947,6 +95947,7 @@ interface MessagePort : EventTarget { // event handlers attribute EventHandler onmessage; + attribute EventHandler onmessageerror; }; @@ -96166,11 +96167,15 @@ interface MessagePort : EventTarget {
  • Let targetRealm be finalTargetPort's relevant Realm.

  • -
  • Let deserializeRecord be - StructuredDeserializeWithTransfer(serializeWithTransferResult, - targetRealm).

  • - +
  • +

    Let deserializeRecord be + StructuredDeserializeWithTransfer(serializeWithTransferResult, + targetRealm).

    + +

    If this throws an exception, fire an event named + messageerror at finalTargetPort, using + MessageEvent, and then abort these steps. +

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

  • @@ -96178,16 +96183,12 @@ interface MessagePort : EventTarget { MessagePort objects in deserializeRecord.[[TransferredValues]], if any, maintaining their relative order.

    -
  • Let e be the result of creating an event using - MessageEvent in targetRealm.

  • - -
  • Initialize e's type attribute to message, its data - attribute to messageClone, and its ports attribute to newPorts.

  • - -
  • Dispatch e at - finalTargetPort.

  • +
  • Fire an event named message at finalTargetPort, using + MessageEvent, with the data attribute + initialized to messageClone and the ports attribute initialized to + newPorts.

  • @@ -96265,6 +96266,7 @@ interface MessagePort : EventTarget { Event handler Event handler event type onmessage message + onmessageerror messageerror @@ -96351,6 +96353,7 @@ interface BroadcastChannel : EventTarget { void postMessage(any message); void close(); attribute EventHandler onmessage; + attribute EventHandler onmessageerror; };
    @@ -96475,10 +96478,17 @@ interface BroadcastChannel : EventTarget {
  • Let targetRealm be destination's relevant Realm.

  • -
  • Let data be StructuredDeserialize(serialized, - targetRealm).

  • - +
  • +

    Let data be StructuredDeserialize(serialized, + targetRealm).

    + +

    If this throws an exception, then fire an event + named messageerror at destination, using + MessageEvent, with the origin + attribute initialized to the Unicode + serialization of sourceSettings's origin, and then abort these steps.

    +
  • Fire an event named message at destination, using @@ -96529,6 +96539,7 @@ interface BroadcastChannel : EventTarget { Event handler Event handler event type onmessage message + onmessageerror messageerror @@ -97131,6 +97142,7 @@ interface DedicatedWorkerGlobalScope : WorkerGlobalScope void close(); attribute EventHandler onmessage; + attribute EventHandler onmessageerror; };

    DedicatedWorkerGlobalScope objects act as if they had an implicit @@ -97191,6 +97203,7 @@ interface DedicatedWorkerGlobalScope : WorkerGlobalScope Event handler Event handler event type onmessage message + onmessageerror messageerror

    For the purposes of the application cache networking model, a dedicated worker is @@ -97849,6 +97862,7 @@ interface Worker : EventTarget { void postMessage(any message, optional sequence<object> transfer = []); attribute EventHandler onmessage; + attribute EventHandler onmessageerror; }; dictionary WorkerOptions { @@ -97916,6 +97930,7 @@ enum WorkerType { "classic", "module" }; Event handler Event handler event type onmessage message + onmessageerror messageerror

    @@ -115102,6 +115117,7 @@ interface External { onhashchange; onlanguagechange; onmessage; + onmessageerror; onoffline; ononline; onpagehide; @@ -118239,6 +118255,12 @@ interface External { message event handler for Window object Event handler content attribute + + onmessageerror + body + messageerror event handler for Window object + Event handler content attribute + onmousedown HTML elements @@ -119130,6 +119152,12 @@ INSERT INTERFACES HERE Window, EventSource, WebSocket, MessagePort, BroadcastChannel, DedicatedWorkerGlobalScope, Worker, ServiceWorkerContainer Fired at an object when it receives a message + + messageerror + MessageEvent + Window, MessagePort, BroadcastChannel, DedicatedWorkerGlobalScope, Worker, ServiceWorkerContainer + Fired at an object when it receives a message that cannot be deserialized + offline Event