From c6ffb89942c33aa9c571c16090bda2f0123d0f23 Mon Sep 17 00:00:00 2001
From: Anne van Kesteren Let serializeWithTransferResult be ?
- StructuredSerializeWithTransfer(value, transferList). Return ?
- StructuredDeserializeWithTransfer(serializeWithTransferResult,
- targetRealm).StructuredCloneWithTransfer ( value,
- transferList, targetRealm )
-
-
-
-
Performing serialization and
transferring from other specifications
@@ -8586,15 +8573,6 @@ o.myself = o;
some guidance on when each abstract operation is typically useful, with examples.
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.
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 @@ -14904,6 +14881,7 @@ c-end = "-->"
onhashchange
onlanguagechange
onmessage
onmessageerror
onoffline
ononline
onpagehide
onhashchange
hashchange
onlanguagechange
languagechange
onmessage
message
+ onmessageerror
messageerror
onoffline
offline
ononline
online
onpagehide
pagehide
@@ -90009,6 +89988,7 @@ interface WindowEventHandlers {
attribute EventHandler onhashchange;
attribute EventHandler onlanguagechange;
attribute EventHandler onmessage;
+ attribute EventHandler onmessageerror;
attribute EventHandler onoffline;
attribute EventHandler ononline;
attribute EventHandler onpagehide;
@@ -95498,37 +95478,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]].
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.
Let origin be the Unicode + serialization of incumbentSettings's origin.
Let newPorts be a new frozen array consisting of all
- MessagePort
objects in cloneRecord.[[TransferredValues]], if any,
- maintaining their relative order.
Let source be the WindowProxy
object's corresponding to
+ incumbentSettings's global
+ object (a Window
object).
Return, but continue running these steps in in parallel.
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.
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.
Let messageClone be deserializeRecord.[[Deserialized]].
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.
Let newPorts be a new frozen array consisting of all
+ MessagePort
objects in deserializeRecord.[[TransferredValues]], if any,
+ maintaining their relative order.
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.
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]].
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.
onmessage
message
+ onmessageerror
messageerror
@@ -96215,6 +96217,7 @@ interface BroadcastChannel : EventTarget {
void postMessage(any message);
void close();
attribute EventHandler onmessage;
+ attribute EventHandler onmessageerror;
};
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
@@ -96393,6 +96403,7 @@ interface BroadcastChannel : EventTarget {
onmessage
message
+ onmessageerror
messageerror
@@ -96982,6 +96993,7 @@ interface DedicatedWorkerGlobalScope : WorkerGlobalScope
void close();
attribute EventHandler onmessage;
+ attribute EventHandler onmessageerror;
};
DedicatedWorkerGlobalScope
objects act as if they had an implicit
@@ -97042,6 +97054,7 @@ interface DedicatedWorkerGlobalScope : WorkerGlobalScope
onmessage
message
+ onmessageerror
messageerror
For the purposes of the application cache networking model, a dedicated worker is @@ -97718,6 +97731,7 @@ interface Worker : EventTarget { void postMessage(any message, optional sequence<object> transfer = []); attribute EventHandler onmessage; + attribute EventHandler onmessageerror; }; dictionary WorkerOptions { @@ -97785,6 +97799,7 @@ enum WorkerType { "classic", "module" };
onmessage
message
+ onmessageerror
messageerror
onhashchange
;
onlanguagechange
;
onmessage
;
+ onmessageerror
;
onoffline
;
ononline
;
onpagehide
;
@@ -118111,6 +118127,12 @@ interface External {
message
event handler for Window
object
onmessageerror
+ body
+ messageerror
event handler for Window
object
+ onmousedown
Window
, EventSource
, WebSocket
, MessagePort
, BroadcastChannel
, DedicatedWorkerGlobalScope
, Worker
, ServiceWorkerContainer
messageerror
+ MessageEvent
+ Window
, MessagePort
, BroadcastChannel
, DedicatedWorkerGlobalScope
, Worker
, ServiceWorkerContainer
+ offline
Event