<br><div class="gmail_quote">On Sat, Aug 1, 2009 at 4:59 PM, Ian Hickson <span dir="ltr"><<a href="mailto:ian@hixie.ch">ian@hixie.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Wed, 22 Jul 2009, Daniel Gredler wrote:<br>
><br>
> First, why does the structured clone algorithm used by postMessage() [1]<br>
> throw an exception if it encounters cycles? It seems to me that the<br>
> memory-based logic which is used to catch cycles could easily be<br>
> modified to resolve them instead. The only possible reason I can think<br>
> of is to match JSON semantics, and the only reason I can think of to<br>
> want to match JSON semantics is to make implementers lives easier<br>
> (witness Firefox 3.5, which just JSONifies objects passed to<br>
> postMessage()). However, this is a huge limitation, and I'm not sure<br>
> that the correct trade-off is to make implementers lives easier at the<br>
> expense of making web designers lives harder.<br>
<br>
</div>Your guess is correct. I imagine we'll lift the restriction eventually; if<br>
you want to make that happen quicker, then I encourage you to speak<br>
directly to the browser vendors implementing this, and convince them it'd<br>
be worth it. :-)<br><div></div></blockquote><div><br><br>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?<br>
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
> Second, why not walk the prototype chain? Similar rules regarding host<br>
> objects and regular objects could apply to prototypes. You would want to<br>
> make sure that multiple references to the same prototype instance result<br>
> in references to a single prototype clone in the cloned object graph.<br>
> Again, though, it doesn't sound too hard (though I might just be<br>
> optimistic). Why not make web designers' lives easier?<br>
<br>
</div>We're definitely never going to copy function code over, so it's not clear<br>
that the prototype chain would be that useful. Could you elaborate on your<br>
use case?<br>
<div class="im"></div></blockquote><div><br><br>I agree that once you've made the decision to not clone functions, cloning the prototype chain becomes (nearly?) useless. However, I'd be interested to know the rationale behind this decision, since Web Workers appear to follow the same-origin policy (e.g. "If the origin of the resulting absolute URL is not the same as the origin of the script that invoked the constructor, then throw a security exception", etc). I assume there's a security concern lurking somewhere?<br>
<br>My specific use case spits out a tree, each node having a reference to its children and its parent (hence the issue with circular references). Each node also has a "name" attribute and a function (in the prototype) used to retrieve the node's "path" (based on its name and its ancestors names) -- I don't want to precalculate each node's path and keep it in memory, given that there are tens of thousands of nodes (or more).<br>
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
> Overall, it just appears that the current web worker spec ignores the<br>
> class of computational problems involving results which need to be<br>
> modeled in a complex way.<br>
<br>
</div>That's probably a fair criticism, yes.<font color="#888888"><br>
</font></blockquote></div><br><br>Then I'll see if I can't raise some awareness amongst implementers ;-)<br><br clear="all"><br>-- <br>Daniel Gredler<br><a href="http://daniel.gredler.net/">http://daniel.gredler.net/</a><br>