Re: postMessage is the new wtf

On Tue, Dec 13, 2011 at 12:30 PM, Charles Pritchard <chuck@jumis.com> wrote:

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

In what we ship today in WebKit, this will be an exception, because cloning
of message ports is not supported.


>
> 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 21:07:09 UTC