[whatwg] reply() extension to postMessage()
hmason at mac.com
Thu Feb 14 08:43:03 PST 2008
On Feb 14, 2008, at 11:18 AM, Anne van Kesteren wrote:
> Given that everyone is now updating their postMessage() code
> anyway, I wonder if it's possible to quickly make another minor
> tweak. The proposal is to remove the source attribute from
> MessageEvent and replace it with a reply() method. The semantics of
> the reply() are probably best described in terms of equivalence.
> That is,
> is equivalent to
> e.source.postMessage(message, e.origin)
Ooo, I like that idea. I have one concern, however. Presumably, the
message event that is sent as a reply could itself be replied. Since
postMessage's spec currently says:
"The postMessage() method must only return once the event dispatch
has been completely processed by the target document (i.e. all three
of the capture, target, and bubble phases have been done, and event
listeners have been executed as appropriate)."
...this behavior could cause some somewhat nasty infinite recursion.
So what if we made reply() asynchronous so that the the reply message
event doesn't need to be dispatched on the original message posting
document until after the original postMessage from the sender is
More information about the whatwg