W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2009

[whatwg] Web Workers and postMessage(): Questions

From: Maciej Stachowiak <mjs@apple.com>
Date: Mon, 03 Aug 2009 10:47:14 -0700
Message-ID: <8557ADEF-BF49-4A66-A8D5-5FAB53CC36E8@apple.com>

On Aug 3, 2009, at 10:34 AM, Daniel Gredler wrote:

>
> On Sat, Aug 1, 2009 at 4:59 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Wed, 22 Jul 2009, Daniel Gredler wrote:
> >
> > First, why does the structured clone algorithm used by  
> postMessage() [1]
> > throw an exception if it encounters cycles? It seems to me that the
> > memory-based logic which is used to catch cycles could easily be
> > modified to resolve them instead. The only possible reason I can  
> think
> > of is to match JSON semantics, and the only reason I can think of to
> > want to match JSON semantics is to make implementers lives easier
> > (witness Firefox 3.5, which just JSONifies objects passed to
> > postMessage()). However, this is a huge limitation, and I'm not sure
> > that the correct trade-off is to make implementers lives easier at  
> the
> > expense of making web designers lives harder.
>
> Your guess is correct. I imagine we'll lift the restriction  
> eventually; if
> you want to make that happen quicker, then I encourage you to speak
> directly to the browser vendors implementing this, and convince them  
> it'd
> be worth it. :-)
>
>
> I know Anne VK (Opera) and ROC (Mozilla) appear to read this list...  
> any comments, guys? Should I just file bugs? Any Safari / Chrome /  
> IE guys out there with comments?

I'd prefer to stick with JSONic object graphs for now. Correctly  
cloning more complicated object structures is a fair bit more  
complicated, so I'd like to get solid interop on the basic cases  
first. Also, the idea is that postMessage() should be sending object  
structures that are essentially pure data. JSON seems to capture  
pretty well the idea of a pure data structure in JavaScript.

Regards,
Maciej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090803/bd232331/attachment.htm>
Received on Monday, 3 August 2009 10:47:14 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:15 UTC