W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Proposal to allow Transferables to be used in initMessageEvent

From: Luke Zarko <zarko@google.com>
Date: Tue, 9 Aug 2011 10:20:58 -0700
Message-ID: <CAMWHaPcGfQBRdbihE1NqMQQ8xRyuaWkjJx4Hr+NhL61UaM_fbQ@mail.gmail.com>
To: public-webapps@w3.org
I came across this while implementing support for the new Transferable[1]
interface for Chromium. initMessageEvent is defined[2] as:

  void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in
boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString
lastEventIdArg, in WindowProxy? sourceArg, in sequence<MessagePort>
portsArg);

However, postMessage is usually defined to take a sequence<Transferable>
[3]:

  void postMessage(in any message, in optional sequence<Transferable>
transfer);

I suggest changing initMessageEvent to permit arbitrary Transferables:

  void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in
boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString
lastEventIdArg, in WindowProxy? sourceArg, in sequence<Transferable>
transferablesArg);

Without this change, it is not possible for a JavaScript author to directly
construct a MessageEvent with a dataArg that contains Transferable objects
(other than MessagePorts).

This does not imply that the ports property of MessageEvent should change.
It should behave just like the ports array for MessageEvents generated by
postMessage: the ports array contains all MessagePorts sent in the transfer
list in the same relative order.

Please let me know what you think!

  Luke

[1]
http://www.whatwg.org/specs/web-apps/current-work/complete/common-dom-interfaces.html#transferable-objects
[2]
http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#event-definitions-1
[3]
http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#message-ports
Received on Thursday, 11 August 2011 22:39:42 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:47 GMT