Re: postMessage is the new wtf

On 12/13/11 11:11 AM, Dmitry Lomov wrote:
>    worker.postMessage({p:port, ab:arrayBuffer}, [post, arrayBuffer])
> work. Therefore this extension to postMessage semantics is both 
> backwards-compatible and consistent. On the receiving side, the 
> 'ports' property of event object will still contain only the message 
> ports from the transfer list, so that behavior is preserved as well.

What's the behavior if an array buffer or port is not on the 
transferrables list?
For example: worker.postMessage({p:port, ab:arrayBuffer})

The clone example you posted makes sense:
worker.postMessage({p:port, ab:arrayBuffer}, [post, arrayBuffer])

If transferrables is supported, it'll ensure the vars are neutered and 
referenced appropriately, and if they aren't supported, it'll still pass 
a copy of array buffer through the message data.


-Charles

Received on Tuesday, 13 December 2011 20:37:25 UTC