W3C home > Mailing lists > Public > public-web-intents@w3.org > November 2011

Re: Transferable Objects, was: Re: Web Messaging Intents, was: Re: [DRAFT] Web Intents Task Force Charter

From: Charles Pritchard <chuck@jumis.com>
Date: Thu, 24 Nov 2011 14:11:00 -0800
Message-ID: <4ECEC0F4.4060206@jumis.com>
To: Rich Tibbett <richt@opera.com>
CC: Paul Kinlan <paulkinlan@google.com>, timeless <timeless@gmail.com>, WebIntents <public-web-intents@w3.org>, Greg Billock <gbillock@google.com>
On 11/22/11 8:10 AM, Rich Tibbett wrote:
> Paul Kinlan wrote:
>> On Tue, Nov 22, 2011 at 3:32 PM, Rich Tibbett<richt@opera.com>  wrote:
>>> Paul Kinlan wrote:
>>>> Someone mentioned earlier get-temperature as an example:
>>>> var channel = new MessageChannel()
>>>> var i = new Intent('get-temperature',
>>>> "application/octet-stream+myprotocol", channel.port2)
>>>> navigator.startActivity(i);
>>> I'm missing how channel.port2 gets propagated to the selected Intent 
>>> Handler
>>> if it is not designated as a Transferable parameter. If the _exact_ 
>>> port2
>>> object is not transferred, then there is no messaging channel to use 
>>> in the
>>> first place...
> ...
>>> I may be missing a trick here.
> ...
>> startActivity uses
>> the structured clone algorithm, that support Transferable objects.
> Of course! Until recently MessagePort wasn't compatible with the 
> structured clone algorithm but since it has recently come to implement 
> Transferable it has become compatible with that algorithm, making your 
> example work and negating the need for a fourth parameter specifically 
> for Transferable objects.
> Thanks for the explanation. This is helpful. I hope we can document 
> this level of detail in a specification soon.

I believe that transferable objects are still shared via "transfer map":

Transferable objects are only handled by the transfer map, not by the 
internal structured cloning algorithm.
It seems like WebIDL may need some more work in this area, per the 
editorial note:

It seems to me that MessagePort could easily be added to the internal 
structured clone algorithm, but,
I don't see that happening for other transferable objects. Again, the 
problem is with ArrayBuffer:

postMessage(ArrayBuffer) // Copy the buffer
postMessage('', [ArrayBuffer]) // Transfer the buffer

I don't think this is an issue that Web Intents introduced, but it seems 
like one that we should clear up ASAP.

Received on Thursday, 24 November 2011 22:11:29 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:14:45 UTC