Re: Proposal to allow Transferables to be used in initMessageEvent

On Tue, 9 Aug 2011, Luke Zarko wrote:
> 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:

While it is possible for postMessage()'s second argument to take non-port 
Transferables (in particular ArrayBuffers), it's not possible for the 
generated event to contain those objects in the event.ports array, so 
there's no reason for the constructor to support that.

> 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).

Why not? The dataArg has type "any".

Ian Hickson               U+1047E                )\._.,--....,'``.    fL       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 11 August 2011 22:52:35 UTC