On Tue, 1 Mar 2011, Aryeh Gregor wrote:
> On Tue, Mar 1, 2011 at 8:51 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> > The big worry here is that you have to be _very_ careful to define
> > behavior properly. It's not an issue for extension APIs, where you
> > can assume that the caller will do sane (and probably non-malicious)
> > things. But for a web API like this you would need to define exactly
> > when and how many times the UA is supposed to get the "clientX"
> > property of the second argument, for example. That's a minimal
> > requirement; there are probably other ratholes here that would need
> > worrying about. :(
> >
> > Alternately, we could require that all the properties be plain data
> > properties or something, to avoid some of those pitfalls.
>
> I think the latter sounds like the right way to go. I can't imagine any
> use-case where you'd need to set anything other than regular old
> properties on the object (and I say that as someone who uses this
> pattern a lot in my own code).
This is an issue with any of the APIs that use the "structured clone"
algorithm also. Currently it can cause an infinite loop (if there's a
getter). If anyone has any advice on how we should fix this problem,
please comment on this bug:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=12101
My current thinking is to just skip over any properties that have getters.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'