Re: [whatwg] BroadcastChannel should support structured clones

2014-04-29 Thread Ian Hickson
On Thu, 17 Apr 2014, Jonas Sicking wrote:

 It would be very useful to be able to send structured data, including 
 Blobs, through the BroadcastChannel API.
 
 This is something we've seen any time we've done storage or message 
 passing, that one of the first thing authors ask for is to not have to 
 do JSON serialization/parsing manually. The ability to pass ArrayBuffers 
 and Blobs is somewhat less commonly asked for, likely because binary 
 data is less often used, but seems important nonetheless.
 
 We can't allow transferring of objects, since you can't transfer 
 something to all listeners of a broadcasting API. But plain structured 
 clones should be no problem to support conceptually (though more work to 
 implement of course).
 
 We've started looking at doing structured clone support for Firefox and 
 likely won't ship until we have that implemented.

This would make a lot of sense. I think when I was first speccing this I 
wanted to avoid transferring and forgot that you could clone without 
transferring! I see that you filed a bug on this:

   https://www.w3.org/Bugs/Public/show_bug.cgi?id=25415

...so I'll track it there. For implementation purposes you can assume that 
I'm going to make this change.


On Thu, 17 Apr 2014, Jonas Sicking wrote:

 Another thing that seems like an oversight in the spec is that the spec 
 currently says that BroadcastChannel should be exposed in Window 
 context. We should also expose it in Worker contexts.

I had filed a bug to track this earlier:

   https://www.w3.org/Bugs/Public/show_bug.cgi?id=24414

If you want to implement this in workers please do go ahead. I was just 
waiting for people to implement it at all before doing the minor work of 
updating the spec for workers (mostly, as noted in the bug, changing the 
responsible document stuff to check for worker event loops instead when 
in a worker, and excluding suspended workers). I've moved the bug back 
onto my radar.


For people following on at home, there's also this bug:

   https://www.w3.org/Bugs/Public/show_bug.cgi?id=25414

...relating to the order of events in a broadcast channel, and this bug:

   https://www.w3.org/Bugs/Public/show_bug.cgi?id=25413

...wherein I'm about to change how channel names are exposed.

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


Re: [whatwg] BroadcastChannel should support structured clones

2014-04-17 Thread Jonas Sicking
Another thing that seems like an oversight in the spec is that the
spec currently says that BroadcastChannel should be exposed in Window
context. We should also expose it in Worker contexts.

/ Jonas

On Thu, Apr 17, 2014 at 2:32 PM, Jonas Sicking jo...@sicking.cc wrote:
 It would be very useful to be able to send structured data, including
 Blobs, through the BroadcastChannel API.

 This is something we've seen any time we've done storage or message
 passing, that one of the first thing authors ask for is to not have to
 do JSON serialization/parsing manually. The ability to pass
 ArrayBuffers and Blobs is somewhat less commonly asked for, likely
 because binary data is less often used, but seems important
 nonetheless.

 We can't allow transferring of objects, since you can't transfer
 something to all listeners of a broadcasting API. But plain structured
 clones should be no problem to support conceptually (though more work
 to implement of course).

 We've started looking at doing structured clone support for Firefox
 and likely won't ship until we have that implemented.

 / Jonas